diff --git a/settings/addon.go b/settings/addon.go index 94c30c57..458323cd 100644 --- a/settings/addon.go +++ b/settings/addon.go @@ -10,10 +10,13 @@ const ( EnvHubBaseURL = "HUB_BASE_URL" EnvHubToken = "TOKEN" EnvTask = "TASK" + EnvHomeDir = "ADDON_HOME" ) // Addon settings. type Addon struct { + // HomeDir working directory. + HomeDir string // Hub settings. Hub struct { // URL for the hub API. @@ -27,6 +30,10 @@ type Addon struct { func (r *Addon) Load() (err error) { var found bool + r.HomeDir, found = os.LookupEnv(EnvHomeDir) + if !found { + r.HomeDir = "/addon" + } r.Hub.URL, found = os.LookupEnv(EnvHubBaseURL) if !found { r.Hub.URL = "http://localhost:8080" diff --git a/settings/hub.go b/settings/hub.go index a87b5fba..a215177e 100644 --- a/settings/hub.go +++ b/settings/hub.go @@ -12,7 +12,6 @@ const ( EnvDbSeedPath = "DB_SEED_PATH" EnvBucketPath = "BUCKET_PATH" EnvRwxSupported = "RWX_SUPPORTED" - EnvAddonPath = "ADDON_PATH" EnvCachePath = "CACHE_PATH" EnvCachePvc = "CACHE_PVC" EnvSharedPath = "SHARED_PATH" @@ -58,10 +57,6 @@ type Hub struct { File struct { TTL int } - // Addon settings - Addon struct { - Path string - } // Cache settings. Cache struct { RWX bool @@ -145,10 +140,6 @@ func (r *Hub) Load() (err error) { b, _ := strconv.ParseBool(s) r.Cache.RWX = b } - r.Addon.Path, found = os.LookupEnv(EnvAddonPath) - if !found { - r.Addon.Path = "/addon" - } r.Cache.PVC, found = os.LookupEnv(EnvCachePvc) if !found { r.Cache.PVC = "cache" diff --git a/task/manager.go b/task/manager.go index c540c4d6..777e4bee 100644 --- a/task/manager.go +++ b/task/manager.go @@ -1718,7 +1718,7 @@ func (r *Task) containers( container.VolumeMounts, core.VolumeMount{ Name: Addon, - MountPath: Settings.Hub.Addon.Path, + MountPath: Settings.Addon.HomeDir, }, core.VolumeMount{ Name: Shared, @@ -1731,8 +1731,8 @@ func (r *Task) containers( container.Env = append( container.Env, core.EnvVar{ - Name: settings.EnvAddonPath, - Value: Settings.Hub.Addon.Path, + Name: settings.EnvHomeDir, + Value: Settings.Addon.HomeDir, }, core.EnvVar{ Name: settings.EnvSharedPath,