Remove environment.Environment struct
This commit completely removes the environment struct as it is no longer used.
This commit is contained in:
parent
3263920d6b
commit
473040a69f
40 changed files with 91 additions and 146 deletions
|
|
@ -1,22 +1,17 @@
|
|||
package validators
|
||||
|
||||
import (
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||
"github.com/tkw1536/pkglib/validator"
|
||||
)
|
||||
|
||||
// New creates a new set of standard validators for the configuration
|
||||
func New(env environment.Environment) validator.Collection {
|
||||
func New() validator.Collection {
|
||||
coll := make(validator.Collection)
|
||||
|
||||
validator.Add(coll, "nonempty", ValidateNonempty)
|
||||
|
||||
validator.Add(coll, "directory", func(value *string, dflt string) error {
|
||||
return ValidateDirectory(env, value, dflt)
|
||||
})
|
||||
validator.Add(coll, "file", func(value *string, dflt string) error {
|
||||
return ValidateFile(env, value, dflt)
|
||||
})
|
||||
validator.Add(coll, "directory", ValidateDirectory)
|
||||
validator.Add(coll, "file", ValidateFile)
|
||||
|
||||
validator.Add(coll, "domain", ValidateDomain)
|
||||
validator.AddSlice(coll, "domains", ",", ValidateDomain)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
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 {
|
||||
func ValidateFile(path *string, dflt string) error {
|
||||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
|
|
@ -16,7 +15,7 @@ func ValidateFile(env environment.Environment, path *string, dflt string) error
|
|||
return nil
|
||||
}
|
||||
|
||||
func ValidateDirectory(env environment.Environment, path *string, dflt string) error {
|
||||
func ValidateDirectory(path *string, dflt string) error {
|
||||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue