Fix bug configGetEnv failed,err:string to int failed: strconv.Atoi: parsing "openim_v3": invalid syntaxr (#2044)

* delete

* add context deadline exceeded

* Error not handled

* Error not handled

* Error not handled

* Error not handled

* configGetEnv failed,err:string to int failed: strconv.Atoi: parsing "openim_v3": invalid syntaxr
This commit is contained in:
skiffer-git 2024-03-08 17:21:50 +08:00 committed by GitHub
parent 057884311a
commit 2acdfde56e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 3 deletions

View File

@ -118,6 +118,7 @@ MONGO_OPENIM_PASSWORD=openIM123
# Default: MONGO_DATABASE=openim_v3 # Default: MONGO_DATABASE=openim_v3
MONGO_DATABASE=openim_v3 MONGO_DATABASE=openim_v3
MONGO_MAX_POOL_SIZE=100
# ----- Redis Configuration ----- # ----- Redis Configuration -----
# Port on which Redis in-memory data structure store is running. # Port on which Redis in-memory data structure store is running.

View File

@ -118,6 +118,7 @@ MONGO_OPENIM_PASSWORD=${MONGO_OPENIM_PASSWORD}
# Default: MONGO_DATABASE=openim_v3 # Default: MONGO_DATABASE=openim_v3
MONGO_DATABASE=${MONGO_DATABASE} MONGO_DATABASE=${MONGO_DATABASE}
MONGO_MAX_POOL_SIZE=${MONGO_MAX_POOL_SIZE}
# ----- Redis Configuration ----- # ----- Redis Configuration -----
# Port on which Redis in-memory data structure store is running. # Port on which Redis in-memory data structure store is running.

View File

@ -63,7 +63,7 @@ function execute_start_scripts() {
if openim::util::is_running_in_container; then if openim::util::is_running_in_container; then
exec > ${DOCKER_LOG_FILE} 2>&1 exec >> ${DOCKER_LOG_FILE} 2>&1
fi fi

View File

@ -297,9 +297,9 @@ func configGetEnv(config *config.GlobalConfig) error {
config.Mongo.Password = getEnv("MONGO_OPENIM_PASSWORD", config.Mongo.Password) config.Mongo.Password = getEnv("MONGO_OPENIM_PASSWORD", config.Mongo.Password)
config.Mongo.Address = getArrEnv("MONGO_ADDRESS", "MONGO_PORT", config.Mongo.Address) config.Mongo.Address = getArrEnv("MONGO_ADDRESS", "MONGO_PORT", config.Mongo.Address)
config.Mongo.Database = getEnv("MONGO_DATABASE", config.Mongo.Database) config.Mongo.Database = getEnv("MONGO_DATABASE", config.Mongo.Database)
maxPoolSize, err := getEnvInt("MONGO_DATABASE", config.Mongo.MaxPoolSize) maxPoolSize, err := getEnvInt("MONGO_MAX_POOL_SIZE", config.Mongo.MaxPoolSize)
if err != nil { if err != nil {
return err return errs.Wrap(err, "MONGO_MAX_POOL_SIZE")
} }
config.Mongo.MaxPoolSize = maxPoolSize config.Mongo.MaxPoolSize = maxPoolSize