DEVELOPMENT ENVIRONMENT

~liljamo/tixe

ref: b76c91464a188c22423f19d39b6aa0bcc3108109 tixe/config/config.go -rw-r--r-- 1.1 KiB
b76c9146Jonni Liljamo feat: doc update, login page divider 1 year, 4 months ago
                                                                                
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
package config

import (
	"log"
	"tixe/util"
)

var TixeConfig *Config

type Config struct {
	// Tixe host, e.g. tixe.liljamo.dev
	// Defaults to 127.0.0.1:8080 for local testing
	Host   string
	// Tixe scheme, http or https (default)
	Scheme string

	PsqlHost   string
	// Postgres port, defaults to 5432
	PsqlPort   string
	PsqlUser   string
	PsqlPwd    string
	PsqlDb     string

	CookieSecret string

	OidcDomain   string
	OidcClientID string
	OidcSecret   string
}

func ParseConfig() {
	log.Print("[tixe/config] Parsing config")

	TixeConfig = &Config{
		Host: util.LoadVar("TIXE_HOST", "127.0.0.1:8080"),
		Scheme: util.LoadVar("TIXE_SCHEME", "http"),

		PsqlHost: util.LoadVar("TIXE_PSQL_HOST", ""),
		PsqlPort: util.LoadVar("TIXE_PSQL_PORT", "5432"),
		PsqlUser: util.LoadVar("TIXE_PSQL_USER", ""),
		PsqlPwd: util.LoadVar("TIXE_PSQL_PASSWORD", ""),
		PsqlDb: util.LoadVar("TIXE_PSQL_DB", ""),

		CookieSecret: util.LoadVar("TIXE_COOKIE_SECRET", ""),

		OidcDomain: util.LoadVar("TIXE_OIDC_DOMAIN", ""),
		OidcClientID: util.LoadVar("TIXE_OIDC_CLIENTID", ""),
		OidcSecret: util.LoadVar("TIXE_OIDC_SECRET", ""),
	}
}