Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,24 @@ import (
)

type Config struct {
ServiceName string
Host string
Port string
AllowedOrigins []string
Env Environment
DSN string
ICN string
Tracing string // url to tracing server, e.g. zipkin
Metrics bool // enable prometheus metrics
}

func New() Config {
host := getEnvDefault("HOST", "0.0.0.0")
port := getEnvDefault("PORT", "8080")
return Config{
ServiceName: "ttz-app",
Host: host,
Port: port,
Host: host,
Port: port,
AllowedOrigins: strings.Split(
getEnvDefault("ALLOWED_ORIGINS", fmt.Sprintf("http://%s:%s,https://%s:%s", host, port, host, port)), ",",
),
Env: Environment(getEnvDefault("ENV", "prod")),
DSN: os.Getenv("DSN"),
ICN: os.Getenv("ICN"),
Tracing: os.Getenv("TRACING"),
Metrics: os.Getenv("METRICS") == "true",
Env: Environment(getEnvDefault("ENV", "prod")),
DSN: os.Getenv("DSN"),
}
}

Expand Down
Loading