| 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 { |
| Giorgi Lekveishvili | 0ccd148 | 2023-06-21 15:02:24 +0400 | [diff] [blame^] | 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 | PrivateDomain string `json:"privateDomain,omitempty"` |
| 20 | PublicIP string `json:"publicIP,omitempty"` |
| 21 | NamespacePrefix string `json:"namespacePrefix,omitempty"` |
| 22 | // GandiAPIToken string `json:"gandiAPIToken,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"` |
| giolekva | 050609f | 2021-12-29 15:51:40 +0400 | [diff] [blame] | 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 | } |