Commit 93fdbec3 authored by Sietse Ringers's avatar Sietse Ringers

refactor: rename database connection string parameter

parent d89c27ba
......@@ -68,9 +68,9 @@ func StartRevocationServer(t *testing.T) {
cred: {Mode: irma.RevocationModeServer},
}
irmaconf, err := irma.NewConfiguration(filepath.Join(testdata, "irma_configuration"), irma.ConfigurationOptions{
RevocationDB: dbstr,
RevocationDBType: dbtype,
RevocationSettings: settings,
RevocationDBConnStr: dbstr,
RevocationDBType: dbtype,
RevocationSettings: settings,
})
require.NoError(t, err)
require.NoError(t, irmaconf.ParseFolder())
......@@ -81,12 +81,12 @@ func StartRevocationServer(t *testing.T) {
SchemesPath: filepath.Join(testdata, "irma_configuration"),
RevocationSettings: settings,
IrmaConfiguration: irmaconf,
RevocationDB: dbstr,
RevocationDBConnStr: dbstr,
RevocationDBType: dbtype,
}
// Connect to database and clear records from previous test runs
g, err := gorm.Open(dbtype, conf.RevocationDB)
g, err := gorm.Open(dbtype, conf.RevocationDBConnStr)
require.NoError(t, err)
require.NoError(t, g.DropTableIfExists((*irma.EventRecord)(nil)).Error)
require.NoError(t, g.DropTableIfExists((*irma.AccumulatorRecord)(nil)).Error)
......
......@@ -94,7 +94,7 @@ func setFlags(cmd *cobra.Command, production bool) error {
flags.String("static-prefix", "/", "Host static files under this URL prefix")
flags.StringP("url", "u", defaulturl, "external URL to server to which the IRMA client connects, \":port\" being replaced by --port value")
flags.String("revocation-db-type", "", "database type for revocation database (supported: mysql, postgres)")
flags.String("revocation-db", "", "connection string for revocation database")
flags.String("revocation-db-str", "", "connection string for revocation database")
flags.Bool("sse", false, "Enable server sent for status updates (experimental)")
flags.IntP("port", "p", 8088, "port at which to listen")
......@@ -202,7 +202,7 @@ func configureServer(cmd *cobra.Command) error {
DisableSchemesUpdate: viper.GetInt("schemes-update") == 0,
IssuerPrivateKeysPath: viper.GetString("privkeys"),
RevocationDBType: viper.GetString("revocation-db-type"),
RevocationDB: viper.GetString("revocation-db"),
RevocationDBConnStr: viper.GetString("revocation-db-str"),
URL: viper.GetString("url"),
DisableTLS: viper.GetBool("no-tls"),
Email: viper.GetString("email"),
......
......@@ -115,11 +115,11 @@ func (sme SchemeManagerError) Error() string {
}
type ConfigurationOptions struct {
Assets string
ReadOnly bool
RevocationDB string
RevocationDBType string
RevocationSettings map[CredentialTypeIdentifier]*RevocationSetting
Assets string
ReadOnly bool
RevocationDBConnStr string
RevocationDBType string
RevocationSettings map[CredentialTypeIdentifier]*RevocationSetting
}
// NewConfiguration returns a new configuration. After this
......@@ -134,7 +134,7 @@ func NewConfiguration(path string, opts ConfigurationOptions) (conf *Configurati
if err = conf.Revocation.Load(
Logger.IsLevelEnabled(logrus.DebugLevel),
opts.RevocationDBType,
opts.RevocationDB,
opts.RevocationDBConnStr,
opts.RevocationSettings,
); err != nil {
return nil, err
......
......@@ -54,7 +54,8 @@ type Configuration struct {
Logger *logrus.Logger `json:"-"`
// Connection string for revocation database
RevocationDB string `json:"revocation_db" mapstructure:"revocation_db"`
RevocationDBConnStr string `json:"revocation_db_str" mapstructure:"revocation_db_str"`
// Database type for revocation database, supported: postgres, mysql
RevocationDBType string `json:"revocation_db_type" mapstructure:"revocation_db_type"`
// Credentials types for which revocation database should be hosted
RevocationSettings map[irma.CredentialTypeIdentifier]*irma.RevocationSetting `json:"revocation_settings" mapstructure:"revocation_settings"`
......@@ -132,10 +133,10 @@ func (conf *Configuration) verifyIrmaConf() error {
}
conf.Logger.WithField("schemes_path", conf.SchemesPath).Info("Determined schemes path")
conf.IrmaConfiguration, err = irma.NewConfiguration(conf.SchemesPath, irma.ConfigurationOptions{
Assets: conf.SchemesAssetsPath,
RevocationDBType: conf.RevocationDBType,
RevocationDB: conf.RevocationDB,
RevocationSettings: conf.RevocationSettings,
Assets: conf.SchemesAssetsPath,
RevocationDBType: conf.RevocationDBType,
RevocationDBConnStr: conf.RevocationDBConnStr,
RevocationSettings: conf.RevocationSettings,
})
if err != nil {
return LogError(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment