Moved github PAT and storage path to env vars
This commit is contained in:
@@ -6,11 +6,6 @@ import (
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type GlobalConfig struct {
|
||||
GithubPat string `yaml:"github_pat"`
|
||||
StoragePath string `yaml:"storage_path"`
|
||||
}
|
||||
|
||||
type SiteConfig struct {
|
||||
Name string `yaml:"name"`
|
||||
Repo string `yaml:"repo"`
|
||||
@@ -23,8 +18,7 @@ type SiteConfig struct {
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Global GlobalConfig `yaml:"global"`
|
||||
Sites []SiteConfig `yaml:"sites"`
|
||||
Sites []SiteConfig `yaml:"sites"`
|
||||
}
|
||||
|
||||
type Error struct {
|
||||
@@ -37,12 +31,6 @@ func (c Error) Error() string {
|
||||
}
|
||||
|
||||
func validateConfig(config *Config) error {
|
||||
if config.Global.GithubPat == "" {
|
||||
return &Error{Field: "global.github_pat", Message: "GitHub PAT is required"}
|
||||
}
|
||||
if config.Global.StoragePath == "" {
|
||||
return &Error{Field: "global.storage_path", Message: "Storage path is required"}
|
||||
}
|
||||
for i, site := range config.Sites {
|
||||
if site.Name == "" {
|
||||
return &Error{Field: "sites[" + string(i) + "].name", Message: "Name is required"}
|
||||
|
||||
Reference in New Issue
Block a user