ARO-RP/cmd/aro/main.go

58 строки
867 B
Go
Исходник Обычный вид История

2019-12-22 20:47:29 +03:00
package main
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"context"
2020-01-21 05:57:53 +03:00
"flag"
"fmt"
2019-12-22 20:47:29 +03:00
"os"
"strings"
utillog "github.com/Azure/ARO-RP/pkg/util/log"
)
var (
gitCommit = "unknown"
)
2020-01-21 05:57:53 +03:00
func usage() {
2020-03-02 16:10:46 +03:00
fmt.Fprintf(flag.CommandLine.Output(), "usage: %s {rp,mirror,monitor,deploy}\n", os.Args[0])
2020-01-21 05:57:53 +03:00
flag.PrintDefaults()
}
2019-12-22 20:47:29 +03:00
func main() {
2020-01-21 05:57:53 +03:00
flag.Usage = usage
flag.Parse()
if len(flag.Args()) != 1 {
usage()
os.Exit(2)
}
2020-01-19 02:46:58 +03:00
ctx := context.Background()
2019-12-22 20:47:29 +03:00
log := utillog.GetLogger()
log.Printf("starting, git commit %s", gitCommit)
var err error
switch strings.ToLower(os.Args[1]) {
case "mirror":
2020-01-19 02:46:58 +03:00
err = mirror(ctx, log)
case "monitor":
err = monitor(ctx, log)
2019-12-22 20:47:29 +03:00
case "rp":
2020-01-19 02:46:58 +03:00
err = rp(ctx, log)
2020-03-02 16:10:46 +03:00
case "deploy":
err = deploy(ctx, log)
2020-01-19 02:46:58 +03:00
default:
usage()
os.Exit(2)
2019-12-22 20:47:29 +03:00
}
if err != nil {
log.Fatal(err)
}
}