| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package config |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "os" |
||
| 5 | "time" |
||
| 6 | ) |
||
| 7 | |||
| 8 | const ( |
||
| 9 | GCThresholdPercent = 0.7 // GCThresholdPercent is the threshold for garbage collection |
||
| 10 | |||
| 11 | GCLimit = 1024 * 1024 * 1024 // GCLimit is the limit for garbage collection |
||
| 12 | |||
| 13 | MB = 1024 * 1024 // MB is the number of bytes in a megabyte |
||
| 14 | |||
| 15 | SentryFlushTimeout = 2 * time.Second // SentryFlushTimeout is the timeout for flushing sentry |
||
| 16 | ) |
||
| 17 | |||
| 18 | // PasswordConfigStruct is the struct for the password config. |
||
| 19 | type PasswordConfigStruct struct { |
||
| 20 | Iterations uint32 // Iterations to use for Argon2ID |
||
| 21 | Memory uint32 // Memory to use for Argon2ID |
||
| 22 | Threads uint8 // Threads to use for Argon2ID |
||
| 23 | KeyLen uint32 // KeyLen to use for Argon2ID |
||
| 24 | SaltLen uint32 // SaltLen to use for Argon2ID |
||
| 25 | } |
||
| 26 | |||
| 27 | func GetConfigPath() string { |
||
| 28 | if IsDevelopment() { |
||
| 29 | return "./cmd/v2/config/config-local" |
||
| 30 | } |
||
| 31 | |||
| 32 | return "./cmd/v2/config/config-prod" |
||
| 33 | } |
||
| 34 | |||
| 35 | func IsProduction() bool { |
||
| 36 | return os.Getenv("APP_ENV") != "dev" |
||
| 37 | } |
||
| 38 | |||
| 39 | func IsDevelopment() bool { |
||
| 40 | return os.Getenv("APP_ENV") == "dev" |
||
| 41 | } |
||
| 42 | |||
| 43 | func GetCallbackURL() string { |
||
| 44 | return os.Getenv("CALLBACK_URL") |
||
| 45 | } |
||
| 46 |