Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/config/v1/load.go
2501 views
1
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package config
6
7
import (
8
"io/ioutil"
9
10
"k8s.io/utils/pointer"
11
"sigs.k8s.io/yaml"
12
)
13
14
func Load(fn string) (*Config, error) {
15
fc, err := ioutil.ReadFile(fn)
16
if err != nil {
17
return nil, err
18
}
19
20
var cfg Config
21
err = yaml.UnmarshalStrict(fc, &cfg)
22
if err != nil {
23
return nil, err
24
}
25
return &cfg, nil
26
}
27
28
// LoadMock produces a valid but non-sensical configuration useful for testing
29
func LoadMock() *Config {
30
return &Config{
31
Kind: InstallationFull,
32
Domain: "gitpod-testing.com",
33
Metadata: Metadata{
34
Region: "eu-west1",
35
},
36
Repository: "eu.gcr.io/gitpod-core-dev/build",
37
Observability: Observability{
38
LogLevel: "debug",
39
},
40
Database: Database{
41
InCluster: pointer.Bool(true),
42
},
43
ObjectStorage: ObjectStorage{
44
InCluster: pointer.Bool(true),
45
},
46
ContainerRegistry: ContainerRegistry{
47
InCluster: pointer.Bool(true),
48
},
49
Certificate: ObjectRef{
50
Kind: ObjectRefSecret,
51
Name: "https-certs",
52
},
53
OpenVSX: OpenVSX{
54
URL: "https://open-vsx.org",
55
},
56
Workspace: Workspace{
57
Runtime: WorkspaceRuntime{
58
FSShiftMethod: FSShiftShiftFS,
59
ContainerDRuntimeDir: "/run/containerd/io.containerd.runtime.v2.task/k8s.io",
60
},
61
},
62
}
63
}
64
65