Add support for configuration of TLS

This commit is contained in:
eikendev 2023-07-15 23:25:34 +02:00
parent 833e666c37
commit 61d5e04ecf
No known key found for this signature in database
GPG key ID: A1BDB1B28C8EF694
8 changed files with 65 additions and 12 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/jinzhu/configor"
"github.com/pushbits/server/internal/log"
"github.com/pushbits/server/internal/pberrors"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v2"
)
@ -231,3 +232,18 @@ func cleanUp() {
log.L.Warnln("Cannot remove config file: ", err)
}
}
func TestConfigurationValidation_ConfigTLSFilesInconsistent(t *testing.T) {
assert := assert.New(t)
c := Configuration{}
c.Admin.MatrixID = "000000"
c.Matrix.Username = "default-username"
c.Matrix.Password = "default-password"
c.HTTP.CertFile = "populated"
c.HTTP.KeyFile = ""
is := validateConfiguration(&c)
should := pberrors.ErrConfigTLSFilesInconsistent
assert.Equal(is, should, "validateConfiguration() should return ConfigTLSFilesInconsistent")
}