Add config loading and dry-run validation

This commit is contained in:
2026-05-31 01:53:13 +00:00
parent 22d0424232
commit 29dbad2967
16 changed files with 928 additions and 17 deletions

View File

@@ -1,3 +1,70 @@
package config
type Config struct{}
type Config struct {
Pipelines []Pipeline `yaml:"pipelines"`
}
type Pipeline struct {
ID string `yaml:"id"`
Source Backend `yaml:"source"`
Validation ValidationPolicy `yaml:"validation"`
Destinations []Destination `yaml:"destinations"`
}
type Destination struct {
ID string `yaml:"id"`
Backend string `yaml:"backend"`
Path string `yaml:"path"`
URI string `yaml:"uri"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
Prefix string `yaml:"prefix"`
Region string `yaml:"region"`
ForcePath bool `yaml:"force_path_style"`
Creds Credentials `yaml:"credentials"`
Publish *PublishPolicy `yaml:"publish"`
Transform Transform `yaml:"transform"`
Transfer TransferPolicy `yaml:"transfer"`
}
type Backend struct {
Backend string `yaml:"backend"`
Path string `yaml:"path"`
URI string `yaml:"uri"`
Endpoint string `yaml:"endpoint"`
Bucket string `yaml:"bucket"`
Prefix string `yaml:"prefix"`
Region string `yaml:"region"`
ForcePath bool `yaml:"force_path_style"`
Creds Credentials `yaml:"credentials"`
}
type Credentials struct {
AccessKeyIDEnv string `yaml:"access_key_id_env"`
SecretAccessKeyEnv string `yaml:"secret_access_key_env"`
}
type ValidationPolicy struct {
OnDigestMismatch string `yaml:"on_digest_mismatch"`
}
type PublishPolicy struct {
Source bool `yaml:"source"`
HTML bool `yaml:"html"`
}
type Transform struct {
MarkdownToHTML *MarkdownToHTML `yaml:"markdown_to_html"`
}
type MarkdownToHTML struct {
Enabled bool `yaml:"enabled"`
Mode string `yaml:"mode"`
}
type TransferPolicy struct {
OnDestinationSame string `yaml:"on_destination_same"`
OnDestinationOlder string `yaml:"on_destination_older"`
OnDestinationNewer string `yaml:"on_destination_newer"`
OnConflict string `yaml:"on_conflict"`
}