Allow global configuration options for API roles.

Add options to the PgUser structure, potentially allowing to set
per-role options in the cluster definition as well.

Introduce api_roles_configuration operator option with the default
of log_statement=all
This commit is contained in:
Oleksii Kliukin
2017-11-22 10:43:35 +01:00
parent 6dcd074ea0
commit 415a7fdc4d
6 changed files with 52 additions and 8 deletions
+6 -1
View File
@@ -645,7 +645,12 @@ func (c *Cluster) initHumanUsers() error {
}
}
c.pgUsers[username] = spec.PgUser{Name: username, Flags: flags, MemberOf: memberOf}
c.pgUsers[username] = spec.PgUser{
Name: username,
Flags: flags,
MemberOf: memberOf,
Parameters: c.OpConfig.APIRolesParameters,
}
}
return nil
+5 -1
View File
@@ -359,7 +359,11 @@ func (c *Cluster) syncRoles(readFromDatabase bool) error {
if err != nil {
return fmt.Errorf("could not init db connection: %v", err)
}
defer c.closeDbConn()
defer func() {
if err := c.closeDbConn(); err != nil {
c.logger.Errorf("could not close db connection: %v", err)
}
}()
if readFromDatabase {
for _, u := range c.pgUsers {