Initial storage for Implementation of push notification

This commit is contained in:
Dan Peleg 2021-04-23 21:28:38 +03:00
parent d6e9b7b307
commit dd8b05c310
18 changed files with 537 additions and 0 deletions

View file

@ -204,6 +204,11 @@ user_api:
max_open_conns: 100
max_idle_conns: 2
conn_max_lifetime: -1
pusher_database:
connection_string: file:userapi_pushers.db
max_open_conns: 100
max_idle_conns: 2
conn_max_lifetime: -1
tracing:
enabled: false
jaeger:

View file

@ -19,6 +19,9 @@ type UserAPI struct {
// The Device database stores session information for the devices of logged
// in local users. It is accessed by the UserAPI.
DeviceDatabase DatabaseOptions `yaml:"device_database"`
// The Pusher database stores user's push notification for the devices of logged
// in local users. It is accessed by the UserAPI.
PusherDatabase DatabaseOptions `yaml:"pusher_database"`
}
const DefaultOpenIDTokenLifetimeMS = 3600000 // 60 minutes
@ -28,8 +31,10 @@ func (c *UserAPI) Defaults() {
c.InternalAPI.Connect = "http://localhost:7781"
c.AccountDatabase.Defaults(10)
c.DeviceDatabase.Defaults(10)
c.PusherDatabase.Defaults(10)
c.AccountDatabase.ConnectionString = "file:userapi_accounts.db"
c.DeviceDatabase.ConnectionString = "file:userapi_devices.db"
c.PusherDatabase.ConnectionString = "file:userapi_pushers.db"
c.BCryptCost = bcrypt.DefaultCost
c.OpenIDTokenLifetimeMS = DefaultOpenIDTokenLifetimeMS
}
@ -39,5 +44,6 @@ func (c *UserAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
checkURL(configErrs, "user_api.internal_api.connect", string(c.InternalAPI.Connect))
checkNotEmpty(configErrs, "user_api.account_database.connection_string", string(c.AccountDatabase.ConnectionString))
checkNotEmpty(configErrs, "user_api.device_database.connection_string", string(c.DeviceDatabase.ConnectionString))
checkNotEmpty(configErrs, "user_api.pusher_database.connection_string", string(c.PusherDatabase.ConnectionString))
checkPositive(configErrs, "user_api.openid_token_lifetime_ms", c.OpenIDTokenLifetimeMS)
}