DEVELOPMENT ENVIRONMENT

~liljamo/felu

ref: 1e596cec12a5c40a210a67fd8106d84ee007b1bc felu/config/config.go -rw-r--r-- 1.3 KiB
1e596cecJonni Liljamo feat: show users in a table 1 year, 30 days 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
/*
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * This file is licensed under AGPL-3.0-or-later, see NOTICE and LICENSE for
 * more information.
 */
package config

import "git.src.quest/~skye/erya-go/util"

var FeluConfig *config

type config struct {
	ServiceName string

	// Initial email for the admin user, only used if no admin account (e.g. first boot)
	InitialAdminEmail string
	// Initial password for the admin user, only used if no admin account (e.g. first boot)
	InitialAdminPwd   string

	// Data directory, with trailing slash
	DataDir string

	FrontendBindAddr string

	BackendBindAddr string

	DNSBindIP   string
	DNSBindPort int32
	DNSPattern  string
}

func InitConfig() {
	FeluConfig = &config {
		ServiceName: util.LoadEnvStr("FELU_SERVICE_NAME", "FeluDDNS"),

		InitialAdminEmail: util.LoadEnvStr("FELU_INITIAL_ADMIN_EMAIL", "admin@example.com"),
		InitialAdminPwd: util.LoadEnvStr("FELU_INITIAL_ADMIN_PWD", "feluadmin"),

		DataDir: util.LoadEnvStr("FELU_DB_PATH", "/var/felu/"),

		FrontendBindAddr: util.LoadEnvStr("FELU_FRONTEND_BIND_ADDR", "0.0.0.0:8080"),

		BackendBindAddr: util.LoadEnvStr("FELU_BACKEND_BIND_ADDR", "0.0.0.0:8081"),

		DNSBindIP: util.LoadEnvStr("FELU_DNS_BIND_IP", "0.0.0.0"),
		DNSBindPort: util.LoadEnvInt32("FELU_DNS_BIND_PORT", 53),
		DNSPattern: util.LoadEnvStr("FELU_DNS_PATTERN", "."),
	}
}