From 65a3a498647f46d741bbdd2a64a7f8ad866183fb Mon Sep 17 00:00:00 2001 From: Melora Hugues Date: Wed, 3 Jan 2024 17:10:20 +0100 Subject: [PATCH] fix: allow setting the issue from environment variables --- polyculeconnect/config/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/polyculeconnect/config/config.go b/polyculeconnect/config/config.go index 690d023..4c2f448 100644 --- a/polyculeconnect/config/config.go +++ b/polyculeconnect/config/config.go @@ -22,6 +22,8 @@ const ( varServerPort envVar = "SERVER_PORT" varServerSocket envVar = "SERVER_SOCK_PATH" + varIssuer envVar = "ISSUER" + varStorageType envVar = "STORAGE_TYPE" varStorageFile envVar = "STORAGE_FILEPATH" varStorageHost envVar = "STORAGE_HOST" @@ -55,6 +57,8 @@ const ( defaultServerPort = 5000 defaultServerSocket = "" + defaultIssuer = "locahost" + defaultStorageType = Memory defaultStorageFile = "./polyculeconnect.db" defaultStorageHost = "127.0.0.1" @@ -145,6 +149,8 @@ func (ac *AppConfig) getConfFromEnv() { ac.StorageConfig.Password = getStringFromEnv(varStoragePassword, defaultStoragePassword) ac.StorageConfig.Ssl.CaFile = getStringFromEnv(varStorageSSLCaFile, defaultStorageSSLCaFile) ac.StorageConfig.Ssl.Mode = getStringFromEnv(varStorageSSLMode, defaultStorageSSLMode) + + ac.OpenConnectConfig.Issuer = getStringFromEnv(varIssuer, defaultIssuer) } func (ac *AppConfig) RedirectURI() string { @@ -154,6 +160,7 @@ func (ac *AppConfig) RedirectURI() string { func New(filepath string) (*AppConfig, error) { var conf AppConfig conf.StorageConfig = &StorageConfig{} + conf.OpenConnectConfig = &OpenConnectConfig{} content, err := os.ReadFile(filepath) if err != nil { if !errors.Is(err, fs.ErrNotExist) {