Fix environment key delimiter & fix environment overrides in docker image

This commit is contained in:
Ullaakut
2019-01-24 09:43:13 +01:00
parent 5849898283
commit 098460702b
2 changed files with 8 additions and 11 deletions
+5 -1
View File
@@ -29,4 +29,8 @@ RUN apk --update add --no-cache nmap \
WORKDIR /app/cameradar WORKDIR /app/cameradar
COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/dictionaries/ /app/dictionaries/ COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/dictionaries/ /app/dictionaries/
COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/cameradar/ /app/cameradar/ COPY --from=build-env /go/src/github.com/Ullaakut/cameradar/cameradar/ /app/cameradar/
ENTRYPOINT ["/app/cameradar/cameradar", "-r", "/app/dictionaries/routes", "-c", "/app/dictionaries/credentials.json"]
ENV CAMERADAR_CUSTOM_ROUTES="/app/dictionaries/routes"
ENV CAMERADAR_CUSTOM_CREDENTIALS="/app/dictionaries/credentials.json"
ENTRYPOINT ["/app/cameradar/cameradar"]
+3 -10
View File
@@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/Ullaakut/cameradar" "github.com/ullaakut/cameradar"
curl "github.com/andelf/go-curl" curl "github.com/andelf/go-curl"
"github.com/fatih/color" "github.com/fatih/color"
@@ -28,17 +28,10 @@ type options struct {
} }
func parseArguments() error { func parseArguments() error {
viper.SetEnvPrefix("cameradar") viper.SetEnvPrefix("cameradar")
viper.BindEnv("targets") viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
viper.BindEnv("ports")
viper.BindEnv("custom-routes")
viper.BindEnv("custom-credentials")
viper.BindEnv("speed")
viper.BindEnv("timeout")
viper.BindEnv("logging")
pflag.StringSliceP("targets", "t", nil, "The targets on which to scan for open RTSP streams - required (ex: 172.16.100.0/24)") pflag.StringSliceP("targets", "t", []string{}, "The targets on which to scan for open RTSP streams - required (ex: 172.16.100.0/24)")
pflag.StringSliceP("ports", "p", []string{"554", "5554", "8554"}, "The ports on which to search for RTSP streams") pflag.StringSliceP("ports", "p", []string{"554", "5554", "8554"}, "The ports on which to search for RTSP streams")
pflag.StringP("custom-routes", "r", "<GOPATH>/src/github.com/Ullaakut/cameradar/dictionaries/routes", "The path on which to load a custom routes dictionary") pflag.StringP("custom-routes", "r", "<GOPATH>/src/github.com/Ullaakut/cameradar/dictionaries/routes", "The path on which to load a custom routes dictionary")
pflag.StringP("custom-credentials", "c", "<GOPATH>/src/github.com/Ullaakut/cameradar/dictionaries/credentials.json", "The path on which to load a custom credentials JSON dictionary") pflag.StringP("custom-credentials", "c", "<GOPATH>/src/github.com/Ullaakut/cameradar/dictionaries/credentials.json", "The path on which to load a custom credentials JSON dictionary")