func main() { logs.InitLogs() defer logs.FlushLogs() defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() startProfiler() rand.Seed(time.Now().UTC().UnixNano()) runtime.GOMAXPROCS(runtime.NumCPU()) flag.Parse() // TODO convert to flags instead of a config file? configurationPath := "" if flag.NArg() > 0 { configurationPath = flag.Arg(0) } if configurationPath == "" { configurationPath = os.Getenv("REGISTRY_CONFIGURATION_PATH") } if configurationPath == "" { fmt.Println("configuration path unspecified") os.Exit(1) } // Prevent a warning about unrecognized environment variable os.Unsetenv("REGISTRY_CONFIGURATION_PATH") configFile, err := os.Open(configurationPath) if err != nil { log.Fatalf("Unable to open configuration file: %s", err) } dockerregistry.Execute(configFile) }
func main() { defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() if len(os.Getenv("GOMAXPROCS")) == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } basename := filepath.Base(os.Args[0]) command := cli.CommandFor(basename) if err := command.Execute(); err != nil { os.Exit(1) } }
func main() { logs.InitLogs() defer logs.FlushLogs() defer serviceability.BehaviorOnPanic(os.Getenv("OPENSHIFT_ON_PANIC"))() defer serviceability.Profile(os.Getenv("OPENSHIFT_PROFILE")).Stop() rand.Seed(time.Now().UTC().UnixNano()) if len(os.Getenv("GOMAXPROCS")) == 0 { runtime.GOMAXPROCS(runtime.NumCPU()) } basename := filepath.Base(os.Args[0]) command := gitserver.CommandFor(basename) if err := command.Execute(); err != nil { os.Exit(1) } }