Skip to content

Commit b5982a2

Browse files
committed
skip some validation on server mode
1 parent e3744ca commit b5982a2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

internal/validation/validator.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func ValidateConfig(config *Config, onPremise bool) error {
1515
if *config.File == "" && !*config.Serve {
1616
return errors.New("No file path/url provided, example usage: getsum /tmp/file ")
1717
}
18-
if *config.RemoteOnly {
18+
if !onPremise && *config.RemoteOnly {
1919
if *config.LocalOnly {
2020
return errors.New("You can not set -localOnly and -remoteOnly at the same time")
2121
}
@@ -40,7 +40,7 @@ func ValidateConfig(config *Config, onPremise bool) error {
4040
return errors.New("Unrecognized algorithm, [" + a + "] supported types: " + supportedAlgs)
4141
}
4242
}
43-
if *config.Dir != "" {
43+
if !onPremise && *config.Dir != "" {
4444
fi, err := os.Stat(*config.Dir)
4545
if os.IsNotExist(err) {
4646
return errors.New("Given -dir parameter " + *config.Dir + "doesnt exist")
@@ -49,14 +49,14 @@ func ValidateConfig(config *Config, onPremise bool) error {
4949
return errors.New("Given -dir parameter is not a directory!")
5050
}
5151
}
52-
if *config.TLSKey != "" && *config.TLSCert == "" {
52+
if !onPremise && *config.TLSKey != "" && *config.TLSCert == "" {
5353
return errors.New("You specified -tlskey but not -tlscert, both parameter required for https/tls mode")
5454
}
55-
if *config.TLSKey == "" && *config.TLSCert != "" {
55+
if !onPremise && *config.TLSKey == "" && *config.TLSCert != "" {
5656
return errors.New("You specified -tlscert but not -tlskey, both parameter required for https/tls mode")
5757
}
5858

59-
if *config.Key != "" && *config.Supplier != "go" {
59+
if !onPremise && *config.Key != "" && *config.Supplier != "go" {
6060
return errors.New("-key parameter only used on go libs currently, set -lib go")
6161
}
6262

0 commit comments

Comments
 (0)