mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
feat: add GetInstallEnvs utility function for configuration management
- Introduced a new function GetInstallEnvs in config.go to retrieve installation environment variables - Added DefaultInstallEnvs constant with an empty default value - Implemented fallback mechanism to split DefaultInstallEnvs if no configuration is found - Enhances configuration flexibility for installation environments
This commit is contained in:
@@ -28,6 +28,7 @@ const (
|
||||
DefaultApiPath = "/api"
|
||||
DefaultNodeMaxRunners = 0 // 0 means no limit
|
||||
DefaultInstallRoot = "/app/install"
|
||||
DefaultInstallEnvs = ""
|
||||
MetadataConfigDirName = ".crawlab"
|
||||
MetadataConfigName = "config.json"
|
||||
DefaultPyenvPath = "/root/.pyenv"
|
||||
@@ -250,6 +251,13 @@ func GetInstallRoot() string {
|
||||
return DefaultInstallRoot
|
||||
}
|
||||
|
||||
func GetInstallEnvs() []string {
|
||||
if res := viper.GetStringSlice("install.envs"); res != nil {
|
||||
return res
|
||||
}
|
||||
return strings.Split(DefaultInstallEnvs, ",")
|
||||
}
|
||||
|
||||
func GetPyenvPath() string {
|
||||
if res := viper.GetString("install.pyenv.path"); res != "" {
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user