Have got publishing to Netlify
This commit is contained in:
parent
8e0ffb6c24
commit
7ef6725bdb
23 changed files with 667 additions and 109 deletions
|
|
@ -1,22 +1,30 @@
|
|||
package config
|
||||
|
||||
import "path/filepath"
|
||||
import (
|
||||
"github.com/Netflix/go-env"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DatabaseURL string `env:"DATABASE_URL"`
|
||||
|
||||
DataDir string `env:"DATA_DIR"`
|
||||
DataStagingDir string `env:"DATA_STAGING_DIR,default=staging"`
|
||||
DatabaseURL string `env:"DATABASE_URL"`
|
||||
NetlifyAuthToken string `env:"NETLIFY_AUTH_TOKEN"`
|
||||
DataDir string `env:"DATA_DIR"`
|
||||
DataStagingDir string `env:"DATA_STAGING_DIR,default=staging"`
|
||||
DataScratchDir string `env:"DATA_SCRATCH_DIR,default=scratch"`
|
||||
}
|
||||
|
||||
func Load() (Config, error) {
|
||||
return Config{
|
||||
DatabaseURL: "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable",
|
||||
DataDir: "build/data",
|
||||
DataStagingDir: "staging",
|
||||
}, nil
|
||||
func Load() (cfg Config, err error) {
|
||||
_, err = env.UnmarshalFromEnviron(&cfg)
|
||||
if err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func (c Config) StagingDir() string {
|
||||
return filepath.Join(c.DataDir, c.DataStagingDir)
|
||||
}
|
||||
|
||||
func (c Config) ScratchDir() string {
|
||||
return filepath.Join(c.DataDir, c.DataScratchDir)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue