From 0f415e2f9df8d6b68155d897a05dc2a9ea9d5464 Mon Sep 17 00:00:00 2001 From: Edward <73746306+WangEdward@users.noreply.github.com> Date: Fri, 14 Jul 2023 10:22:30 +0000 Subject: [PATCH] feat(oauth): add config for oauth --- config.default.yml | 6 ++++++ config/config.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/config.default.yml b/config.default.yml index 5f089fe..ec5b310 100644 --- a/config.default.yml +++ b/config.default.yml @@ -74,6 +74,12 @@ subscriptions: stripe_endpoint_secret: standard_price_id: +oauth: + enabled: false # whether to enable oauth + provider: # one of ['github', 'microsoft', 'google'] + client_id: # oauth client id + client_secret: # oauth client secret + mail: enabled: true # whether to enable mails (used for password resets, reports, etc.) provider: smtp # method for sending mails, currently one of ['smtp', 'mailwhale'] diff --git a/config/config.go b/config/config.go index 4d2da45..8a7d027 100644 --- a/config/config.go +++ b/config/config.go @@ -144,6 +144,13 @@ type sentryConfig struct { SampleRateHeartbeats float32 `yaml:"sample_rate_heartbeats" default:"0.1" env:"WAKAPI_SENTRY_SAMPLE_RATE_HEARTBEATS"` } +type oauthConfig struct { + Enabled bool `env:"WAKAPI_OAUTH_ENABLED" default:"false"` + Provider string `env:"WAKAPI_OAUTH_PROVIDER" default:"github"` + ClientId string `yaml:"client_id" env:"WAKAPI_OAUTH_CLIENT_ID"` + ClientSecret string `yaml:"client_secret" env:"WAKAPI_OAUTH_CLIENT_SECRET"` +} + type mailConfig struct { Enabled bool `env:"WAKAPI_MAIL_ENABLED" default:"true"` Provider string `env:"WAKAPI_MAIL_PROVIDER" default:"smtp"` @@ -178,6 +185,7 @@ type Config struct { Server serverConfig Subscriptions subscriptionsConfig Sentry sentryConfig + OAuth oauthConfig Mail mailConfig }