Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/dev/preview/previewctl/main.go
2497 views
1
// Copyright (c) 2022 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 main
6
7
import (
8
"os"
9
10
"github.com/sirupsen/logrus"
11
12
"github.com/gitpod-io/gitpod/previewctl/cmd"
13
)
14
15
func main() {
16
logger := logrus.New()
17
logger.SetFormatter(&logrus.TextFormatter{
18
DisableColors: true,
19
FullTimestamp: true,
20
TimestampFormat: "2006-01-02 15:04:05",
21
})
22
23
if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") == "" {
24
if credFile := os.Getenv("PREVIEW_ENV_DEV_SA_KEY_PATH"); credFile != "" {
25
_, err := os.Stat(credFile)
26
if err == nil {
27
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", credFile)
28
}
29
}
30
}
31
32
root := cmd.NewRootCmd(logger)
33
if err := root.Execute(); err != nil {
34
logger.WithFields(logrus.Fields{"err": err}).Fatal("command failed.")
35
}
36
}
37
38