diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-18 02:05:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-18 02:05:37 +0900 |
| commit | 6e405347ad218a6eb2ac1e24a6074deb41f74407 (patch) | |
| tree | ff1480da8395ea677ace7cdf0c27f073bae5cbfb /backend/config.go | |
| parent | e2a7c44805a3dea3790c7f4e2f9787dd9ff66102 (diff) | |
| download | phperkaigi-2025-albatross-6e405347ad218a6eb2ac1e24a6074deb41f74407.tar.gz phperkaigi-2025-albatross-6e405347ad218a6eb2ac1e24a6074deb41f74407.tar.zst phperkaigi-2025-albatross-6e405347ad218a6eb2ac1e24a6074deb41f74407.zip | |
feat(backend): do not define local-only routes in prod env
Diffstat (limited to 'backend/config.go')
| -rw-r--r-- | backend/config.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/config.go b/backend/config.go index c083542..99a6d54 100644 --- a/backend/config.go +++ b/backend/config.go @@ -11,6 +11,7 @@ type Config struct { dbUser string dbPassword string dbName string + isLocal bool } func NewConfigFromEnv() (*Config, error) { @@ -34,11 +35,14 @@ func NewConfigFromEnv() (*Config, error) { if !exists { return nil, fmt.Errorf("ALBATROSS_DB_NAME not set") } + isLocalStr, exists := os.LookupEnv("ALBATROSS_IS_LOCAL") + isLocal := exists && isLocalStr == "1" return &Config{ dbHost: dbHost, dbPort: dbPort, dbUser: dbUser, dbPassword: dbPassword, dbName: dbName, + isLocal: isLocal, }, nil } |
