23 lines
509 B
Go
23 lines
509 B
Go
|
package config
|
||
|
|
||
|
import "path/filepath"
|
||
|
|
||
|
type Config struct {
|
||
|
DatabaseURL string `env:"DATABASE_URL"`
|
||
|
|
||
|
DataDir string `env:"DATA_DIR"`
|
||
|
DataStagingDir string `env:"DATA_STAGING_DIR,default=staging"`
|
||
|
}
|
||
|
|
||
|
func Load() (Config, error) {
|
||
|
return Config{
|
||
|
DatabaseURL: "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable",
|
||
|
DataDir: "build/data",
|
||
|
DataStagingDir: "staging",
|
||
|
}, nil
|
||
|
}
|
||
|
|
||
|
func (c Config) StagingDir() string {
|
||
|
return filepath.Join(c.DataDir, c.DataStagingDir)
|
||
|
}
|