| giolekva | 8aa73e8 | 2022-07-09 11:34:39 +0400 | [diff] [blame] | 1 | package installer |
| giolekva | 050609f | 2021-12-29 15:51:40 +0400 | [diff] [blame] | 2 | |
| Giorgi Lekveishvili | bd6be7f | 2023-05-26 15:51:28 +0400 | [diff] [blame] | 3 | import ( |
| 4 | "io" |
| 5 | "io/ioutil" |
| 6 | |
| 7 | "sigs.k8s.io/yaml" |
| 8 | ) |
| 9 | |
| giolekva | 050609f | 2021-12-29 15:51:40 +0400 | [diff] [blame] | 10 | type Config struct { |
| 11 | Values Values `json:"values"` |
| 12 | } |
| 13 | |
| 14 | type 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 Lekveishvili | 4d2784d | 2023-06-01 14:27:32 +0400 | [diff] [blame^] | 19 | PrivateDomain string `json:"privateDomain,omitempty"` |
| giolekva | 050609f | 2021-12-29 15:51:40 +0400 | [diff] [blame] | 20 | 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 Lekveishvili | bd6be7f | 2023-05-26 15:51:28 +0400 | [diff] [blame] | 33 | |
| 34 | func 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 | } |