@@ -10,7 +10,7 @@ import (
1010/* database parameters */
1111type Database struct {
1212 TransactionLogRedis TransactionLogRedis `yaml:"transaction_log_redis,omitempty"`
13- ArchivalPQ ArchivalPQ `yaml:"archival_postgres,omitempty"`
13+ ArchivalPQ ArchivalPQ `yaml:"archival_postgres,omitempty"`
1414}
1515
1616/* transaction log redis parameters */
@@ -22,12 +22,12 @@ type TransactionLogRedis struct {
2222
2323/* archival PostgreSQL parameters */
2424type ArchivalPQ struct {
25- Host string `yaml:"host,omitempty"`
26- Port int `yaml:"port,omitempty"`
27- User string `yaml:"user,omitempty"`
28- Password string `yaml:"password,omitempty"`
29- DBName string `yaml:"dbname,omitempty"`
30- SSLMode string `yaml:"sslmode,omitempty"`
25+ Host string `yaml:"host,omitempty"`
26+ Port int `yaml:"port,omitempty"`
27+ User string `yaml:"user,omitempty"`
28+ Password string `yaml:"password,omitempty"`
29+ DBName string `yaml:"dbname,omitempty"`
30+ SSLMode string `yaml:"sslmode,omitempty"`
3131}
3232
3333/* normalization function for database */
@@ -41,7 +41,7 @@ func (d *Database) Normalize() error {
4141 /* check if PostgreSQL parameters are valid */
4242 err = d .ArchivalPQ .Normalize ()
4343 if err != nil {
44- return err
44+ return err
4545 }
4646
4747 return nil
@@ -73,33 +73,33 @@ func (a *ArchivalPQ) Normalize() error {
7373
7474 /* return localhost if empty */
7575 if a .Host == "" {
76- a .Host = "localhost"
77- }
76+ a .Host = "localhost"
77+ }
7878
7979 /* return default port if empty */
80- if a .Port == 0 {
81- a .Port = 5432
82- }
80+ if a .Port == 0 {
81+ a .Port = 5432
82+ }
8383
8484 /* username is mandatory */
85- if a .User == "" {
86- return errors .New ("Database username is not set in the configuration." )
87- }
85+ if a .User == "" {
86+ return errors .New ("Database username is not set in the configuration." )
87+ }
8888
8989 /* dbname is mandatory */
90- if a .DBName == "" {
91- return errors .New ("Database name (dbname) is not set in the configuration." )
92- }
90+ if a .DBName == "" {
91+ return errors .New ("Database name (dbname) is not set in the configuration." )
92+ }
9393
9494 /* sslmode is disabled by default */
95- if a .SSLMode == "" {
96- a .SSLMode = "disable"
97- }
95+ if a .SSLMode == "" {
96+ a .SSLMode = "disable"
97+ }
9898
9999 /* empty password but give a warning */
100- if a .Password == "" {
101- fmt .Printf ("Warning: Connecting to PostgreSQL without a password. Consider using one for security.\n \n " )
102- }
100+ if a .Password == "" {
101+ fmt .Printf ("Warning: Connecting to PostgreSQL without a password. Consider using one for security.\n \n " )
102+ }
103103
104- return nil
104+ return nil
105105}
0 commit comments