Skip to content

Commit

Permalink
ensure that REPOSITORY env var is set after credentials
Browse files Browse the repository at this point in the history
Signed-off-by: Maxmilian Bertsch <max.bertsch@gmx.de>
  • Loading branch information
JcGKitten committed Mar 6, 2024
1 parent ff43386 commit dd64772
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion operator/executor/envvarconverter.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ func (e *EnvVarConverter) setEntry(key string, value envVarEntry) {
// are set the string will have precedence.
func (e *EnvVarConverter) Convert() []corev1.EnvVar {
vars := make([]corev1.EnvVar, 0)
var repositoryVar corev1.EnvVar
var repositoryVarSet bool
for key, value := range e.Vars {

envVar := corev1.EnvVar{
Name: key,
}
Expand All @@ -59,7 +62,17 @@ func (e *EnvVarConverter) Convert() []corev1.EnvVar {
} else if value.stringEnv != nil {
envVar.Value = *value.stringEnv
}
vars = append(vars, envVar)
if key == cfg.ResticRepositoryEnvName {
// set repository env var at the end so the rest backend url
// can use previous set rest server credentials
repositoryVar = envVar
repositoryVarSet = true
} else {
vars = append(vars, envVar)
}
}
if repositoryVarSet {
vars = append(vars, repositoryVar)
}
return vars
}
Expand Down

0 comments on commit dd64772

Please sign in to comment.