diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-13 22:13:14 -0800 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-13 22:13:14 -0800 |
| commit | 9656e14fc758053f34f5cb0e906093e2a18f6162 (patch) | |
| tree | 3d7799305de92be6a09bcd12c29fe0843b7b8cab /internal/configloader/configloader.go | |
| parent | Remove migration dependencies (diff) | |
| download | cli-9656e14fc758053f34f5cb0e906093e2a18f6162.zip | |
Remove timestamp version style in favor of always using sequential
Diffstat (limited to 'internal/configloader/configloader.go')
| -rw-r--r-- | internal/configloader/configloader.go | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/internal/configloader/configloader.go b/internal/configloader/configloader.go index 81a9564..1d36ae8 100644 --- a/internal/configloader/configloader.go +++ b/internal/configloader/configloader.go @@ -10,31 +10,16 @@ package configloader import ( "errors" - "fmt" "os" "path/filepath" - "reflect" "runtime" "git.sr.ht/~eugenetriguba/envelope" "github.com/BurntSushi/toml" ) -type VersionStyle string - -const ( - VersionStyleSequential VersionStyle = "sequential" - VersionStyleTimestamp VersionStyle = "timestamp" -) - -var ( - ErrConfigFileNotFound = errors.New( - "bolt configuration file not found in current directory or any parent directories", - ) - ErrInvalidVersionStyle = fmt.Errorf( - "invalid version style for bolt migrations. supported styles: %v", - []VersionStyle{VersionStyleSequential, VersionStyleTimestamp}, - ) +var ErrConfigFileNotFound = errors.New( + "bolt configuration file not found in current directory or any parent directories", ) // Config represents the application configuration settings. @@ -50,8 +35,7 @@ type Config struct { } type MigrationsConfig struct { - DirectoryPath string `toml:"directory_path" env:"DIR_PATH"` - VersionStyle VersionStyle `toml:"version_style" env:"VERSION_STYLE"` + DirectoryPath string `toml:"directory_path" env:"DIR_PATH"` } type ConnectionConfig struct { @@ -60,12 +44,6 @@ type ConnectionConfig struct { MigrationsTable string `toml:"migrations_table" env:"MIGRATIONS_TABLE"` } -func init() { - envelope.RegisterTypeParser(reflect.TypeOf(VersionStyleSequential), envelope.TypeParserFunc(func(value string) (any, error) { - return VersionStyle(value), nil - })) -} - func NewConfig() (*Config, error) { filePath, err := findConfigFilePath() if err != nil && !errors.Is(err, ErrConfigFileNotFound) { @@ -75,7 +53,6 @@ func NewConfig() (*Config, error) { cfg := Config{ Migrations: MigrationsConfig{ DirectoryPath: "migrations", - VersionStyle: VersionStyleTimestamp, }, Connection: ConnectionConfig{ MigrationsTable: "bolt_migrations", @@ -93,11 +70,6 @@ func NewConfig() (*Config, error) { return nil, err } - if cfg.Migrations.VersionStyle != VersionStyleSequential && - cfg.Migrations.VersionStyle != VersionStyleTimestamp { - return nil, ErrInvalidVersionStyle - } - return &cfg, nil } |