Remove unused report output config
This commit is contained in:
@@ -223,7 +223,6 @@ func (r Runner) resolveGenerate(args []string) (app.GenerateRequest, error) {
|
||||
Path: opts.ConfigPath,
|
||||
Units: opts.Units,
|
||||
Timezone: opts.Timezone,
|
||||
Output: opts.Output,
|
||||
})
|
||||
if err != nil {
|
||||
return app.GenerateRequest{}, err
|
||||
|
||||
@@ -17,7 +17,6 @@ type Config struct {
|
||||
MissingSource MissingSourceConfig `yaml:"missing_source"`
|
||||
Scriptorium ScriptoriumConfig `yaml:"scriptorium"`
|
||||
Workspace WorkspaceConfig `yaml:"workspace"`
|
||||
Reports ReportOutputConfig `yaml:"reports"`
|
||||
Dayparts []DaypartConfig `yaml:"dayparts"`
|
||||
RecentChange RecentChangeConfig `yaml:"recent_change"`
|
||||
}
|
||||
@@ -52,11 +51,6 @@ type WorkspaceConfig struct {
|
||||
PreflightDir string `yaml:"preflight_dir"`
|
||||
}
|
||||
|
||||
type ReportOutputConfig struct {
|
||||
OutputDir string `yaml:"output_dir"`
|
||||
Paths map[string]string `yaml:"paths"`
|
||||
}
|
||||
|
||||
type DaypartConfig struct {
|
||||
Name string `yaml:"name"`
|
||||
Start string `yaml:"start"`
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestInvalidConfigProducesActionableError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadAppliesOverrides(t *testing.T) {
|
||||
cfg, err := Load(LoadOptions{Units: "metric", Timezone: "+09:30", Output: "./out"})
|
||||
cfg, err := Load(LoadOptions{Units: "metric", Timezone: "+09:30"})
|
||||
if err != nil {
|
||||
t.Fatalf("Load() error = %v", err)
|
||||
}
|
||||
@@ -102,7 +102,4 @@ func TestLoadAppliesOverrides(t *testing.T) {
|
||||
if cfg.WeatherAPI.Timezone != "+09:30" {
|
||||
t.Fatalf("Timezone = %q, want +09:30", cfg.WeatherAPI.Timezone)
|
||||
}
|
||||
if cfg.Reports.OutputDir != "./out" {
|
||||
t.Fatalf("OutputDir = %q, want ./out", cfg.Reports.OutputDir)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,6 @@ func Defaults() Config {
|
||||
DataPackagesDir: "data-packages",
|
||||
PreflightDir: "preflight",
|
||||
},
|
||||
Reports: ReportOutputConfig{
|
||||
OutputDir: "reports",
|
||||
Paths: map[string]string{},
|
||||
},
|
||||
Dayparts: []DaypartConfig{
|
||||
{Name: "overnight", Start: "00:00", End: "06:00"},
|
||||
{Name: "morning", Start: "06:00", End: "12:00"},
|
||||
|
||||
@@ -12,7 +12,6 @@ type LoadOptions struct {
|
||||
Path string
|
||||
Units string
|
||||
Timezone string
|
||||
Output string
|
||||
}
|
||||
|
||||
func Load(opts LoadOptions) (Config, error) {
|
||||
@@ -35,9 +34,6 @@ func Load(opts LoadOptions) (Config, error) {
|
||||
if opts.Timezone != "" {
|
||||
cfg.WeatherAPI.Timezone = opts.Timezone
|
||||
}
|
||||
if opts.Output != "" {
|
||||
cfg.Reports.OutputDir = opts.Output
|
||||
}
|
||||
|
||||
if err := Validate(cfg); err != nil {
|
||||
return Config{}, err
|
||||
@@ -61,8 +57,5 @@ func mergeFile(cfg *Config, path string) error {
|
||||
if cfg.MissingSource.Sources == nil {
|
||||
cfg.MissingSource.Sources = map[string]MissingSourcePolicy{}
|
||||
}
|
||||
if cfg.Reports.Paths == nil {
|
||||
cfg.Reports.Paths = map[string]string{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -58,9 +58,6 @@ func Validate(cfg Config) error {
|
||||
if cfg.Workspace.Root == "" {
|
||||
return fmt.Errorf("workspace.root is required")
|
||||
}
|
||||
if cfg.Reports.OutputDir == "" {
|
||||
return fmt.Errorf("reports.output_dir is required")
|
||||
}
|
||||
if len(cfg.Dayparts) == 0 {
|
||||
return fmt.Errorf("dayparts must contain at least one entry")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user