mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
35 lines
643 B
Go
35 lines
643 B
Go
package modules
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
|
|
"github.com/formancehq/operator/apis/stack/v1beta3"
|
|
)
|
|
|
|
func AuthEnvVars(stackURL, moduleName string, auth *v1beta3.AuthConfig) ContainerEnv {
|
|
ret := ContainerEnv{}
|
|
|
|
ret = ret.Append(
|
|
Env("AUTH_ENABLED", "true"),
|
|
Env("AUTH_ISSUER", fmt.Sprintf("%s/api/auth", stackURL)),
|
|
)
|
|
|
|
if auth != nil {
|
|
if auth.ReadKeySetMaxRetries != 0 {
|
|
ret = ret.Append(
|
|
Env("AUTH_READ_KEY_SET_MAX_RETRIES", strconv.Itoa(auth.ReadKeySetMaxRetries)),
|
|
)
|
|
}
|
|
|
|
if auth.CheckScopes {
|
|
ret = ret.Append(
|
|
Env("AUTH_CHECK_SCOPES", "true"),
|
|
Env("AUTH_SERVICE", moduleName),
|
|
)
|
|
}
|
|
}
|
|
|
|
return ret
|
|
}
|