Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/cmd/init.go
2498 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 cmd
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/installer/pkg/config"
11
"github.com/spf13/cobra"
12
)
13
14
// initCmd represents the init command
15
var initCmd = &cobra.Command{
16
Use: "init",
17
Deprecated: `use "config init" command instead`,
18
Short: "Create a base config file",
19
Long: `Create a base config file
20
21
This file contains all the credentials to install a Gitpod instance and
22
be saved to a repository.`,
23
Example: ` # Save config to config.yaml.
24
gitpod-installer init > config.yaml`,
25
Run: func(cmd *cobra.Command, args []string) {
26
cfg, err := config.NewDefaultConfig()
27
if err != nil {
28
panic(err)
29
}
30
fc, err := config.Marshal(config.CurrentVersion, cfg)
31
if err != nil {
32
panic(err)
33
}
34
35
fmt.Print(string(fc))
36
},
37
}
38
39
func init() {
40
rootCmd.AddCommand(initCmd)
41
}
42
43