Added database config and docker image.
This commit is contained in:
parent
590910bc41
commit
259c666548
2 changed files with 29 additions and 5 deletions
|
|
@ -6,6 +6,13 @@ import (
|
|||
"github.com/joeshaw/envdecode"
|
||||
)
|
||||
|
||||
const (
|
||||
TemplateDir = "views"
|
||||
TemplateExt = ".gohtml"
|
||||
StaticDir = "static"
|
||||
StaticPrefix = "files"
|
||||
)
|
||||
|
||||
type Env string
|
||||
|
||||
const (
|
||||
|
|
@ -18,9 +25,10 @@ const (
|
|||
|
||||
// Config stores complete application configuration
|
||||
type Config struct {
|
||||
HTTP HTTPConfig
|
||||
App AppConfig
|
||||
Cache CacheConfig
|
||||
HTTP HTTPConfig
|
||||
App AppConfig
|
||||
Cache CacheConfig
|
||||
Database DatabaseConfig
|
||||
}
|
||||
|
||||
// HTTPConfig stores HTTP configuration
|
||||
|
|
@ -50,6 +58,14 @@ type CacheConfig struct {
|
|||
}
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
Hostname string `env:"DB_HOSTNAME,default=localhost"`
|
||||
Port uint16 `env:"DB_PORT,default=5432"`
|
||||
User string `env:"DB_USER,default=admin"`
|
||||
Password string `env:"DB_PASSWORD,default=admin"`
|
||||
Database string `env:"DB_NAME,default=app"`
|
||||
}
|
||||
|
||||
// GetConfig loads and returns application configuration
|
||||
func GetConfig() (Config, error) {
|
||||
var cfg Config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue