DB scripts and migrations

This commit is contained in:
2024-12-09 19:54:00 +02:00
parent 7a36614232
commit 6cf507bdc9
5 changed files with 66 additions and 54 deletions

View File

@@ -17,6 +17,7 @@ const (
EnvResponseTimeout = "RESPONSE_TIMEOUT"
EnvPanicOnUnexpectedError = "PANIC_ON_UNEXPECTED_ERROR"
EnvBlacklistPath = "BLACKLIST_PATH"
EnvDryRun = "DRY_RUN"
)
// Config holds the application configuration loaded from environment variables.
@@ -28,6 +29,7 @@ type Config struct {
WorkerBatchSize int // Batch size for worker processing
PanicOnUnexpectedError bool // Panic on unexpected errors when visiting a URL
BlacklistPath string // File that has blacklisted strings of "host:port"
DryRun bool // If false, don't write to disk
}
var CONFIG Config //nolint:gochecknoglobals
@@ -126,6 +128,14 @@ func GetConfig() *Config {
config.BlacklistPath = v
return nil
},
EnvDryRun: func(v string) error {
val, err := parseBool(EnvDryRun, v)
if err != nil {
return err
}
config.DryRun = val
return nil
},
}
// Process each environment variable