blob: 991ea5dcf0fddd8b90a47cf2745db4e58dbd5419 [file] [log] [blame]
iomodo48c837e2021-02-19 01:17:07 +04001package model
2
3const (
4 databaseDriverPostgres = "postgres"
5 defaultDataSource = "postgres://user:test@localhost/pcloud_test?sslmode=disable&connect_timeout=10"
6)
7
8type Config struct {
9 SqlSettings SqlSettings
10}
11
12func (c *Config) SetDefaults() {
13 c.SqlSettings.SetDefaults()
14}
15
16type SqlSettings struct {
17 DriverName string `access:"environment,write_restrictable,cloud_restrictable"`
18 DataSource string `access:"environment,write_restrictable,cloud_restrictable"`
19}
20
21func (s *SqlSettings) SetDefaults() {
22 if s.DriverName == "" {
23 s.DriverName = databaseDriverPostgres
24 }
25
26 if s.DataSource == "" {
27 s.DataSource = defaultDataSource
28 }
29}