hmn/src/config/types.go

30 lines
529 B
Go
Raw Normal View History

2021-03-09 08:05:07 +00:00
package config
import "fmt"
type Environment string
const (
Live Environment = "live"
Beta = "beta"
Dev = "dev"
)
type HMNConfig struct {
Env Environment
2021-03-11 03:19:39 +00:00
Addr string
2021-03-09 08:05:07 +00:00
Postgres PostgresConfig
}
type PostgresConfig struct {
User string
Password string
Hostname string
Port int
DbName string
}
func (info PostgresConfig) DSN() string {
return fmt.Sprintf("user=%s password=%s host=%s port=%d dbname=%s", info.User, info.Password, info.Hostname, info.Port, info.DbName)
}