[wip] configuration

This commit is contained in:
Simon Vieille 2024-03-12 06:59:49 +01:00
commit ddfd8bdcef
Signed by: deblan
GPG key ID: 579388D585F70417
4 changed files with 103 additions and 0 deletions

40
config/config.go Normal file
View file

@ -0,0 +1,40 @@
package config
import (
"errors"
"github.com/urfave/cli/v2"
)
type DatabaseConfig struct {
Type string
Dsn string
}
type AnonymizationConfig struct {
}
func LoadDatabaseConfig(c *cli.Context) (error, DatabaseConfig) {
config := DatabaseConfig{
Type: c.String("type"),
Dsn: c.String("dsn"),
}
if config.Type == "" {
return errors.New("You must specify a database type"), config
}
if config.Dsn == "" {
return errors.New("You must specify a database DSN"), config
}
return nil, config
}
func LoadAnonymizationConfig(c *cli.Context) (error, AnonymizationConfig) {
config := AnonymizationConfig{
Type: c.String("type"),
Dsn: c.String("dsn"),
}
return nil, config
}