mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
38 lines
920 B
Go
38 lines
920 B
Go
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License-AGPL.txt in the project root for license information.
|
|
|
|
package config
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
|
|
"github.com/gitpod-io/gitpod/blobserve/pkg/blobserve"
|
|
)
|
|
|
|
// Config configures this service
|
|
type Config struct {
|
|
BlobServe blobserve.Config `json:"blobserve"`
|
|
AuthCfg string `json:"dockerAuth"`
|
|
PProfAddr string `json:"pprofAddr"`
|
|
PrometheusAddr string `json:"prometheusAddr"`
|
|
ReadinessProbeAddr string `json:"readinessProbeAddr"`
|
|
}
|
|
|
|
// getConfig loads and validates the configuration
|
|
func GetConfig(fn string) (*Config, error) {
|
|
fc, err := os.ReadFile(fn)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var cfg Config
|
|
err = json.Unmarshal(fc, &cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &cfg, nil
|
|
}
|