Skip to content

Commit

Permalink
Fix environment key delimiter & fix environment overrides in docker i…
Browse files Browse the repository at this point in the history
…mage
  • Loading branch information
Ullaakut committed Jan 24, 2019
1 parent 5849898 commit 0984607
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ RUN apk --update add --no-cache nmap \
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/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"]
15 changes: 4 additions & 11 deletions cameradar/cameradar.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"time"

"github.com/Ullaakut/cameradar"
"github.com/ullaakut/cameradar"

curl "github.com/andelf/go-curl"
"github.com/fatih/color"
Expand All @@ -28,17 +28,10 @@ type options struct {
}

func parseArguments() error {

viper.SetEnvPrefix("cameradar")
viper.BindEnv("targets")
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)")
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))

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.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")
Expand Down

0 comments on commit 0984607

Please sign in to comment.