Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <[email protected]>
  • Loading branch information
jortel committed Oct 9, 2024
1 parent 4e6e923 commit e81d7c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 7 additions & 0 deletions settings/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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"
Expand Down
9 changes: 0 additions & 9 deletions settings/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -58,10 +57,6 @@ type Hub struct {
File struct {
TTL int
}
// Addon settings
Addon struct {
Path string
}
// Cache settings.
Cache struct {
RWX bool
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions task/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit e81d7c5

Please sign in to comment.