From 7b9a3b48024892bce156ff73dcb96b5d20b655ec Mon Sep 17 00:00:00 2001 From: Everest Date: Tue, 16 Jan 2024 02:06:43 -0300 Subject: [PATCH] add app host env var --- internal/user/oauth_providers.go | 3 ++- lib/config/config.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/user/oauth_providers.go b/internal/user/oauth_providers.go index 53f6f00..35839ab 100644 --- a/internal/user/oauth_providers.go +++ b/internal/user/oauth_providers.go @@ -1,6 +1,7 @@ package user import ( + "fmt" "log/slog" "github.com/markbates/goth" @@ -17,7 +18,7 @@ func registerProviders() { github.New( cfg.Providers.Github.Key, cfg.Providers.Github.Secret, - "http://localhost:8000/auth/github/callback", + fmt.Sprintf("%s/auth/github/callback", cfg.AppHost), "user", ), ) diff --git a/lib/config/config.go b/lib/config/config.go index 016a2c5..4f1fac9 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -1,6 +1,7 @@ package config type Config struct { + AppHost string `env:"HOST" envDefault:"http://localhost:8000"` HTTPPort int `env:"PORT" envDefault:"8000"` Environment string `env:"ENVIRONMENT" envDefault:"unknown"` LogLevel string `env:"LOG_LEVEL" envDefault:"debug"`