34 lines
912 B
Go
34 lines
912 B
Go
package config
|
|
|
|
type Auth struct {
|
|
Providers AuthProviders `envPrefix:"PROVIDERS_"`
|
|
}
|
|
|
|
type AuthProviders struct {
|
|
Google OAuth2Provider `envPrefix:"GOOGLE_"`
|
|
Github OAuth2Provider `envPrefix:"GITHUB_"`
|
|
Gitea GiteaProvider `envPrefix:"GITEA_"`
|
|
OIDC OIDCProvider `envPrefix:"OIDC_"`
|
|
}
|
|
|
|
type OAuth2Provider struct {
|
|
Key string `env:"KEY,expand"`
|
|
Secret string `env:"SECRET,expand"`
|
|
Scopes []string `env:"SCOPES,expand"`
|
|
}
|
|
|
|
type OIDCProvider struct {
|
|
OAuth2Provider
|
|
DiscoveryURL string `env:"DISCOVERY_URL,expand"`
|
|
Icon string `env:"ICON,expand" envDefault:"fa-passport"`
|
|
Label string `env:"LABEL,expand" envDefault:"OpenID Connect"`
|
|
}
|
|
|
|
type GiteaProvider struct {
|
|
OAuth2Provider
|
|
TokenURL string `env:"TOKEN_URL,expand"`
|
|
AuthURL string `env:"AUTH_URL,expand"`
|
|
ProfileURL string `env:"PROFILE_URL,expand"`
|
|
Label string `env:"LABEL,expand" envDefault:"Gitea"`
|
|
}
|