@@ -13,8 +13,7 @@ func LoadConfigs(pathToConfig string) {
13
13
14
14
// Handle errors reading the config file
15
15
if err := viper .ReadInConfig (); err != nil {
16
- ErrorLogger .Println ("No config file detected" , err .Error ())
17
- return
16
+ WarningLogger .Println ("No config file detected" , err .Error ())
18
17
}
19
18
20
19
/* set defaults */
@@ -32,6 +31,22 @@ func LoadConfigs(pathToConfig string) {
32
31
viper .SetDefault ("tweaks_full_with_dust_filter" , false )
33
32
viper .SetDefault ("tweaks_cut_through_with_dust_filter" , false )
34
33
34
+ // Bind viper keys to environment variables (optional, for backup)
35
+ viper .AutomaticEnv ()
36
+ viper .BindEnv ("host" , "HOST" )
37
+ viper .BindEnv ("chain" , "CHAIN" )
38
+ viper .BindEnv ("rpc_endpoint" , "RPC_ENDPOINT" )
39
+ viper .BindEnv ("cookie_path" , "COOKIE_PATH" )
40
+ viper .BindEnv ("rpc_pass" , "RPC_PASS" )
41
+ viper .BindEnv ("rpc_user" , "RPC_USER" )
42
+ viper .BindEnv ("sync_start_height" , "SYNC_START_HEIGHT" )
43
+ viper .BindEnv ("max_parallel_requests" , "MAX_PARALLEL_REQUESTS" )
44
+ viper .BindEnv ("max_parallel_tweak_computations" , "MAX_PARALLEL_TWEAK_COMPUTATIONS" )
45
+ viper .BindEnv ("tweaks_only" , "TWEAKS_ONLY" )
46
+ viper .BindEnv ("tweaks_full_basic" , "TWEAKS_FULL_BASIC" )
47
+ viper .BindEnv ("tweaks_full_with_dust_filter" , "TWEAKS_FULL_WITH_DUST_FILTER" )
48
+ viper .BindEnv ("tweaks_cut_through_with_dust_filter" , "TWEAKS_CUT_THROUGH_WITH_DUST_FILTER" )
49
+
35
50
/* read and set config variables */
36
51
// General
37
52
SyncStartHeight = viper .GetUint32 ("sync_start_height" )
@@ -80,7 +95,7 @@ func LoadConfigs(pathToConfig string) {
80
95
}
81
96
82
97
if TweaksCutThroughWithDust && TweaksOnly {
83
- err := errors .New ("cut through requires tweaks_only to be set to 1 " )
98
+ err := errors .New ("cut through requires tweaks_only to be set to 0 " )
84
99
ErrorLogger .Println (err )
85
100
os .Exit (1 )
86
101
}
0 commit comments