From 6096e3a09b70e699596cfd4b9c5b9005f372e940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sun, 26 Mar 2017 17:51:30 -0700 Subject: [PATCH] Add port to the list of options PORT env variable is used by gin, but adding it to the list of config options will generate a flag for it and provide value validation --- README.md | 4 ++++ config/config.go | 1 + 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index d25b2c685..ff6789fc4 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,10 @@ HTTP port to listen on. Example: PORT=8000 +This option can also be set using `-port` flag. Example: + + $ unsee -port 8000 + Default is `8080`. #### SENTRY_DSN diff --git a/config/config.go b/config/config.go index bf08dee4a..82d657f0f 100644 --- a/config/config.go +++ b/config/config.go @@ -30,6 +30,7 @@ type configEnvs struct { Debug bool `envconfig:"DEBUG" default:"false" help:"Enable debug mode"` FilterDefault string `envconfig:"FILTER_DEFAULT" help:"Default filter string"` JiraRegexp spaceSeparatedList `envconfig:"JIRA_REGEX" help:"List of JIRA regex rules"` + Port int `envconfig:"PORT" default:"8080" help:"HTTP port to listen on"` SentryDSN string `envconfig:"SENTRY_DSN" help:"Sentry DSN for Go exceptions"` SentryPublicDSN string `envconfig:"SENTRY_PUBLIC_DSN" help:"Sentry DSN for javascript exceptions"` StripLabels spaceSeparatedList `envconfig:"STRIP_LABELS" help:"List of labels to ignore"`