-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathappconfig.go
52 lines (43 loc) · 1.16 KB
/
appconfig.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
2020 © Postgres.ai
*/
package resources
import (
"path"
)
// AppConfig currently stores Postgres configuration (other application in the future too).
type AppConfig struct {
CloneName string
DockerImage string
Pool *Pool
Host string
Port uint
DB *DB
NetworkID string
ProvisionHosts string
ContainerConf map[string]string
pgExtraConf map[string]string
}
// DB describes a default database configuration.
type DB struct {
Username string
DBName string
}
// CloneDir returns the path of the clone directory.
func (c *AppConfig) CloneDir() string {
// TODO(akartasov): Move to pool.
return path.Join(c.Pool.ClonesDir(), c.CloneName)
}
// DataDir returns the path of clone data.
func (c *AppConfig) DataDir() string {
// TODO(akartasov): Move to pool.
return path.Join(c.Pool.ClonesDir(), c.CloneName, c.Pool.DataSubDir)
}
// ExtraConf returns a map with an extra configuration.
func (c *AppConfig) ExtraConf() map[string]string {
return c.pgExtraConf
}
// SetExtraConf sets a map with an extra configuration.
func (c *AppConfig) SetExtraConf(extraConf map[string]string) {
c.pgExtraConf = extraConf
}