Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/blobserve/pkg/config/config.go
2506 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 blobserve_config
6
7
import (
8
"encoding/json"
9
"os"
10
)
11
12
// Config configures this service
13
type Config struct {
14
BlobServe BlobServe `json:"blobserve"`
15
AuthCfg string `json:"dockerAuth"`
16
PProfAddr string `json:"pprofAddr"`
17
PrometheusAddr string `json:"prometheusAddr"`
18
ReadinessProbeAddr string `json:"readinessProbeAddr"`
19
}
20
21
// getConfig loads and validates the configuration
22
func GetConfig(fn string) (*Config, error) {
23
fc, err := os.ReadFile(fn)
24
if err != nil {
25
return nil, err
26
}
27
28
var cfg Config
29
err = json.Unmarshal(fc, &cfg)
30
if err != nil {
31
return nil, err
32
}
33
34
return &cfg, nil
35
}
36
37