blob: f234d043f6901d5a8f5021b67c3e857589849485 [file] [log] [blame]
giolekva8aa73e82022-07-09 11:34:39 +04001package installer
giolekva050609f2021-12-29 15:51:40 +04002
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +04003import (
4 "io"
5 "io/ioutil"
6
7 "sigs.k8s.io/yaml"
8)
9
giolekva050609f2021-12-29 15:51:40 +040010type Config struct {
11 Values Values `json:"values"`
12}
13
14type Values struct {
15 PCloudEnvName string `json:"pcloudEnvName,omitempty"`
16 Id string `json:"id,omitempty"`
17 ContactEmail string `json:"contactEmail,omitempty"`
18 Domain string `json:"domain,omitempty"`
Giorgi Lekveishvili4d2784d2023-06-01 14:27:32 +040019 PrivateDomain string `json:"privateDomain,omitempty"`
giolekva050609f2021-12-29 15:51:40 +040020 PublicIP string `json:"publicIP,omitempty"`
21 GandiAPIToken string `json:"gandiAPIToken,omitempty"`
22 NamespacePrefix string `json:"namespacePrefix,omitempty"`
23 LighthouseAuthUIIP string `json:"lighthouseAuthUIIP,omitempty"`
24 LighthouseMainIP string `json:"lighthouseMainIP,omitempty"`
25 LighthouseMainPort string `json:"lighthouseMainPort,omitempty"`
26 MXHostname string `json:"mxHostname,omitempty"`
27 MailGatewayAddress string `json:"mailGatewayAddress,omitempty"`
28 MatrixOAuth2ClientSecret string `json:"matrixOAuth2ClientSecret,omitempty"`
29 MatrixStorageSize string `json:"matrixStorageSize,omitempty"`
30 PiholeOAuth2ClientSecret string `json:"piholeOAuth2ClientSecret,omitempty"`
31 PiholeOAuth2CookieSecret string `json:"piholeOAuth2CookieSecret,omitempty"`
32}
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040033
34func ReadConfig(r io.Reader) (Config, error) {
35 var cfg Config
36 contents, err := ioutil.ReadAll(r)
37 if err != nil {
38 return cfg, err
39 }
40 err = yaml.UnmarshalStrict(contents, &cfg)
41 return cfg, err
42}