-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.go
63 lines (54 loc) · 967 Bytes
/
config.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
53
54
55
56
57
58
59
60
61
62
63
package main
import "os"
func port() string {
port := os.Getenv("PORT")
if len(port) == 0 {
port = "8080"
}
return ":" + port
}
func postgresHost() string {
host := os.Getenv("POSTGRES_HOST")
if len(host) == 0 {
host = "localhost"
}
return host
}
func postgresPort() string {
return "5432"
}
func postgresUser() string {
user := os.Getenv("POSTGRES_USER")
if len(user) == 0 {
user = "postgres"
}
return user
}
func postgresPassword() string {
pwd := os.Getenv("POSTGRES_PASSWORD")
if len(pwd) == 0 {
pwd = "postgres"
}
return pwd
}
func postgresDb() string {
db := os.Getenv("POSTGRES_DB")
if len(db) == 0 {
db = "weather"
}
return db
}
func weatherUri() string {
uri := os.Getenv("WEATHER_URI")
if len(uri) == 0 {
uri = "https://api.openweathermap.org"
}
return uri
}
func weatherAppid() string {
appid := os.Getenv("WEATHER_APPID")
if len(appid) == 0 {
appid = "5b3f51e527ba4ee2ba87940ce9705cb5"
}
return appid
}