generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
34 lines (26 loc) · 729 Bytes
/
main.go
File metadata and controls
34 lines (26 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Greenhouse contributors
// SPDX-License-Identifier: Apache-2.0
package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"github.com/spf13/viper"
"github.com/cloudoperators/cloudctl/cmd"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
)
func main() {
// Optionally read environment variables, config files, etc.
viper.SetEnvPrefix("CLOUDCTL")
viper.AutomaticEnv()
// Graceful cancellation on SIGINT/SIGTERM
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
if err := cmd.Execute(ctx); err != nil {
// Print errors to stderr
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}