You've already forked ionscale
mirror of
https://github.com/jsiebens/ionscale.git
synced 2026-04-05 12:32:58 +01:00
chore: configure auth provider using env variables
This commit is contained in:
@@ -50,6 +50,10 @@ const (
|
||||
loggingLevelKey = "IONSCALE_LOGGING_LEVEL"
|
||||
loggingFormatKey = "IONSCALE_LOGGING_FORMAT"
|
||||
loggingFileKey = "IONSCALE_LOGGING_FILE"
|
||||
authProviderIssuerKey = "IONSCALE_AUTH_PROVIDER_ISSUER"
|
||||
authProviderClientIdKey = "IONSCALE_AUTH_PROVIDER_CLIENT_ID"
|
||||
authProviderClientSecretKey = "IONSCALE_AUTH_PROVIDER_CLIENT_SECRET"
|
||||
authProviderScopesKey = "IONSCALE_AUTH_PROVIDER_SCOPES"
|
||||
)
|
||||
|
||||
func defaultConfig() *Config {
|
||||
@@ -73,7 +77,12 @@ func defaultConfig() *Config {
|
||||
CertMagicEmail: GetString(tlsCertMagicEmailKey, ""),
|
||||
CertMagicStoragePath: GetString(tlsCertMagicStoragePath, ""),
|
||||
},
|
||||
AuthProvider: AuthProvider{},
|
||||
AuthProvider: AuthProvider{
|
||||
Issuer: GetString(authProviderIssuerKey, ""),
|
||||
ClientID: GetString(authProviderClientIdKey, ""),
|
||||
ClientSecret: GetString(authProviderClientSecretKey, ""),
|
||||
Scopes: GetStrings(authProviderScopesKey, nil),
|
||||
},
|
||||
Logging: Logging{
|
||||
Level: GetString(loggingLevelKey, "info"),
|
||||
Format: GetString(loggingFormatKey, ""),
|
||||
|
||||
@@ -20,3 +20,11 @@ func GetString(key, defaultValue string) string {
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
func GetStrings(key string, defaultValue []string) []string {
|
||||
v := os.Getenv(key)
|
||||
if v != "" {
|
||||
return strings.Split(v, ",")
|
||||
}
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user