Skip to content

Commit 0d97bfb

Browse files
authored
Merge pull request #66 from PDOK/require_image_flags
Remove hardcoded references to images in a private repository. Images…
2 parents c2bd146 + 1b3ffd2 commit 0d97bfb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

cmd/main.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ import (
4949
// +kubebuilder:scaffold:imports
5050
)
5151

52-
const (
53-
defaultAtomGeneratorImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/atom-generator:0.6.2"
54-
defaultLighttpdImage = "acrpdokprodman.azurecr.io/mirror/docker.io/pdok/lighttpd:1.4.67"
55-
)
56-
5752
var (
5853
scheme = runtime.NewScheme()
5954
setupLog = ctrl.Log.WithName("setup")
@@ -99,8 +94,8 @@ func main() {
9994
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
10095
flag.StringVar(&baseURL, "atom-baseurl", "", "The base url which is used in the atom service.")
10196
flag.StringVar(&blobEndpoint, "blob-endpoint", "", "The blobstore endpoint used for file downloads.")
102-
flag.StringVar(&atomGeneratorImage, "atom-generator-image", defaultAtomGeneratorImage, "The image to use in the Atom generator init-container.")
103-
flag.StringVar(&lighttpdImage, "lighttpd-image", defaultLighttpdImage, "The image to use in the Atom pod.")
97+
flag.StringVar(&atomGeneratorImage, "atom-generator-image", "", "The image to use in the Atom generator init-container.")
98+
flag.StringVar(&lighttpdImage, "lighttpd-image", "", "The image to use in the Atom pod.")
10499
flag.StringVar(&slackWebhookURL, "slack-webhook-url", "", "The webhook url for sending slack messages. Disabled if left empty")
105100
flag.IntVar(&logLevel, "log-level", 0, "The zapcore loglevel. 0 = info, 1 = warn, 2 = error")
106101
flag.StringVar(&csp, "csp", "", "Content-Security-Policy to serve as a HTTP header")
@@ -123,16 +118,21 @@ func main() {
123118

124119
ctrl.SetLogger(logrLogger)
125120

126-
if baseURL == "" {
127-
setupLog.Error(errors.New("baseURL is required"), "A value for baseURL must be specified.")
128-
os.Exit(1)
121+
reqFlags := make(map[string]string)
122+
reqFlags["baseurl"] = baseURL
123+
reqFlags["blobEndpoint"] = blobEndpoint
124+
reqFlags["atom-generator-image"] = atomGeneratorImage
125+
reqFlags["lighttpd-image"] = lighttpdImage
126+
127+
for reqFlag, val := range reqFlags {
128+
if val == "" {
129+
setupLog.Error(errors.New(reqFlag+" is a required flag"), "A value for "+reqFlag+" must be specified.")
130+
os.Exit(1)
131+
}
129132
}
133+
130134
pdoknlv3.SetBaseURL(baseURL)
131135

132-
if blobEndpoint == "" {
133-
setupLog.Error(errors.New("blobEndpoint is required"), "A value for blobEndpoint must be specified.")
134-
os.Exit(1)
135-
}
136136
pdoknlv3.SetBlobEndpoint(blobEndpoint)
137137

138138
// if the enable-http2 flag is false (the default), http/2 should be disabled

0 commit comments

Comments
 (0)