Skip to content

Commit 56435a6

Browse files
authored
Merge pull request #115 from fystack/fix-check-required-config
Fix check required config
2 parents 81cc92f + e05ac61 commit 56435a6

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

cmd/mpcium/main.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ func runNode(ctx context.Context, c *cli.Command) error {
123123

124124
viper.SetDefault("backup_enabled", true)
125125
config.InitViperConfig(configPath)
126-
127-
appConfig := config.LoadConfig()
128-
environment := appConfig.Environment
126+
environment := viper.GetString("environment")
129127
logger.Init(environment, debug)
130128

131129
// Print ASCII banner
@@ -140,10 +138,10 @@ func runNode(ctx context.Context, c *cli.Command) error {
140138
// Handle configuration based on prompt flag
141139
if usePrompts {
142140
promptForSensitiveCredentials()
143-
} else {
144-
// Validate the config values
145-
checkRequiredConfigValues(appConfig)
146141
}
142+
appConfig := config.LoadConfig()
143+
// Validate the config values
144+
checkRequiredConfigValues(appConfig)
147145

148146
consulClient := infra.GetConsulClient(environment)
149147
keyinfoStore := keyinfo.NewStore(consulClient.KV())
@@ -405,7 +403,7 @@ func maskString(s string) string {
405403
// Check required configuration values are present
406404
func checkRequiredConfigValues(appConfig *config.AppConfig) {
407405
// Show warning if we're using file-based config but no password is set
408-
if appConfig.BadgerPassword == "" {
406+
if viper.GetString("badger_password") == "" {
409407
logger.Fatal("Badger password is required", nil)
410408
}
411409

0 commit comments

Comments
 (0)