Move to yaml-based configuration
This commit updates the configuration to be yaml-based and updates the configuration to read in a yaml file.
This commit is contained in:
parent
568c005d15
commit
945329a080
70 changed files with 1150 additions and 350 deletions
27
internal/config/validators/files.go
Normal file
27
internal/config/validators/files.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
package validators
|
||||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/fsx"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func ValidateFile(env environment.Environment, path *string, dflt string) error {
|
||||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
if !fsx.IsFile(env, *path) {
|
||||
return errors.Errorf("%q does not exist or is not a file", *path)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateDirectory(env environment.Environment, path *string, dflt string) error {
|
||||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
if !fsx.IsDirectory(env, *path) {
|
||||
return errors.Errorf("%q does not exist or is not a directory", *path)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue