Path: blob/main/components/ws-daemon/pkg/config/config.go
2501 views
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package config56import (7"bytes"8"encoding/json"9"os"1011"golang.org/x/xerrors"1213"github.com/gitpod-io/gitpod/common-go/baseserver"14"github.com/gitpod-io/gitpod/ws-daemon/pkg/daemon"15)1617func Read(fn string) (*Config, error) {18ctnt, err := os.ReadFile(fn)19if err != nil {20return nil, xerrors.Errorf("cannot read config file: %w", err)21}2223var cfg Config24dec := json.NewDecoder(bytes.NewReader(ctnt))25dec.DisallowUnknownFields()26err = dec.Decode(&cfg)27if err != nil {28return nil, xerrors.Errorf("cannot parse config file: %w", err)29}3031return &cfg, nil32}3334type Config struct {35Daemon daemon.Config `json:"daemon"`36Service baseserver.ServerConfiguration `json:"service"`37}383940