File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ use code0_flow:: flow_config:: env_with_default;
2+ use code0_flow:: flow_config:: environment:: Environment ;
3+ use code0_flow:: flow_config:: mode:: Mode ;
4+
5+ /// Struct for all relevant `Taurus` startup configurations
6+ pub struct Config {
7+ /// Options:
8+ /// `development` (default)
9+ /// `staging`
10+ /// `production`
11+ pub environment : Environment ,
12+
13+ /// Aquila mode
14+ ///
15+ /// Options:
16+ /// `static` (default)
17+ /// `hybrid`
18+ pub mode : Mode ,
19+
20+ pub nats_url : String ,
21+
22+ pub aquila_url : String ,
23+
24+ pub with_health_service : bool ,
25+
26+ pub grpc_host : String ,
27+
28+ pub grpc_port : u16 ,
29+ }
30+
31+ /// Implementation for all relevant `Aquila` startup configurations
32+ ///
33+ /// Behavior:
34+ /// Searches for the env. file at root level. Filename: `.env`
35+ impl Config {
36+ pub fn new ( ) -> Self {
37+ Config {
38+ environment : env_with_default ( "ENVIRONMENT" , Environment :: Development ) ,
39+ mode : env_with_default ( "MODE" , Mode :: STATIC ) ,
40+ nats_url : env_with_default ( "NATS_URL" , String :: from ( "nats://localhost:4222" ) ) ,
41+ aquila_url : env_with_default ( "AQUILA_URL" , String :: from ( "http://localhost:50051" ) ) ,
42+ with_health_service : env_with_default ( "WITH_HEALTH_SERVICE" , false ) ,
43+ grpc_host : env_with_default ( "GRPC_HOST" , "127.0.0.1" . to_string ( ) ) ,
44+ grpc_port : env_with_default ( "GRPC_PORT" , 50051 ) ,
45+ }
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments