blob: fa171e83081862895b1dd97944864e686128c9f1 [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"`
19 PublicIP string `json:"publicIP,omitempty"`
20 GandiAPIToken string `json:"gandiAPIToken,omitempty"`
21 NamespacePrefix string `json:"namespacePrefix,omitempty"`
22 LighthouseAuthUIIP string `json:"lighthouseAuthUIIP,omitempty"`
23 LighthouseMainIP string `json:"lighthouseMainIP,omitempty"`
24 LighthouseMainPort string `json:"lighthouseMainPort,omitempty"`
25 MXHostname string `json:"mxHostname,omitempty"`
26 MailGatewayAddress string `json:"mailGatewayAddress,omitempty"`
27 MatrixOAuth2ClientSecret string `json:"matrixOAuth2ClientSecret,omitempty"`
28 MatrixStorageSize string `json:"matrixStorageSize,omitempty"`
29 PiholeOAuth2ClientSecret string `json:"piholeOAuth2ClientSecret,omitempty"`
30 PiholeOAuth2CookieSecret string `json:"piholeOAuth2CookieSecret,omitempty"`
31}
Giorgi Lekveishvilibd6be7f2023-05-26 15:51:28 +040032
33func ReadConfig(r io.Reader) (Config, error) {
34 var cfg Config
35 contents, err := ioutil.ReadAll(r)
36 if err != nil {
37 return cfg, err
38 }
39 err = yaml.UnmarshalStrict(contents, &cfg)
40 return cfg, err
41}