-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (32 loc) · 813 Bytes
/
main.go
File metadata and controls
39 lines (32 loc) · 813 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
35
36
37
38
39
package main
import (
"flag"
"fmt"
"os"
"runtime"
log "github.com/Sirupsen/logrus"
"github.com/openshift/origin/pkg/cmd/dockerregistry"
)
func main() {
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)
}