fix: slice envs

This commit is contained in:
Lakhan Samani
2022-05-31 08:14:03 +05:30
parent c61c3024ec
commit cf8762b7a0
35 changed files with 557 additions and 317 deletions

View File

@@ -69,7 +69,7 @@ func InitRequiredEnv() error {
err := godotenv.Load(envPath)
if err != nil {
log.Info("using OS env instead of %s file", envPath)
log.Infof("using OS env instead of %s file", envPath)
}
dbURL := os.Getenv(constants.EnvKeyDatabaseURL)
@@ -84,6 +84,12 @@ func InitRequiredEnv() error {
dbCACert := os.Getenv(constants.EnvKeyDatabaseCACert)
redisURL := os.Getenv(constants.EnvKeyRedisURL)
if strings.TrimSpace(redisURL) == "" {
if cli.ARG_REDIS_URL != nil && *cli.ARG_REDIS_URL != "" {
redisURL = *cli.ARG_REDIS_URL
}
}
if strings.TrimSpace(dbType) == "" {
if cli.ARG_DB_TYPE != nil && *cli.ARG_DB_TYPE != "" {
dbType = strings.TrimSpace(*cli.ARG_DB_TYPE)