allowed origins moved to env
This commit is contained in:
parent
e3f893ac2d
commit
05ed7dc868
4 changed files with 24 additions and 17 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package config
|
||||
|
||||
import "strings"
|
||||
|
||||
type Config struct {
|
||||
AppConf AppConfig
|
||||
DBConf DatabaseConfig
|
||||
|
|
@ -7,11 +9,12 @@ type Config struct {
|
|||
}
|
||||
|
||||
type AppConfig struct {
|
||||
Host string
|
||||
Port string
|
||||
LogLvl string
|
||||
ApiPrefix string
|
||||
GinMode string
|
||||
Host string
|
||||
Port string
|
||||
LogLvl string
|
||||
ApiPrefix string
|
||||
GinMode string
|
||||
AllowedOrigins []string
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
|
|
@ -34,11 +37,12 @@ type JWTConfig struct {
|
|||
func NewConfig() *Config {
|
||||
return &Config{
|
||||
AppConf: AppConfig{
|
||||
Host: getEnv("APP_HOST", ""),
|
||||
Port: getEnv("APP_PORT", ""),
|
||||
LogLvl: getEnv("APP_LOGLVL", ""),
|
||||
ApiPrefix: getEnv("APP_API_PREFIX", ""),
|
||||
GinMode: getEnv("APP_GIN_MODE", ""),
|
||||
Host: getEnv("APP_HOST", ""),
|
||||
Port: getEnv("APP_PORT", ""),
|
||||
LogLvl: getEnv("APP_LOGLVL", ""),
|
||||
ApiPrefix: getEnv("APP_API_PREFIX", ""),
|
||||
GinMode: getEnv("APP_GIN_MODE", ""),
|
||||
AllowedOrigins: strings.Split(getEnv("APP_ALLOWED_ORIGINS", ""), ","),
|
||||
},
|
||||
|
||||
DBConf: DatabaseConfig{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue