File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ Settings:
39
39
40
40
Environment variable|default|description
41
41
--------------------|-------|------------
42
- RABBIT_URL | < http://localhost:15672 > | url to rabbitMQ management plugin
42
+ RABBIT_URL | < http://localhost:15672 > | url to rabbitMQ management plugin (must start with http(s)://)
43
43
RABBIT_USER | guest | username for rabbitMQ management plugin
44
44
RABBIT_PASSWORD | guest | password for rabbitMQ management plugin
45
45
RABBIT_USER_FILE| | location of file with username (useful for docker secrets)
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "fmt"
4
5
"io/ioutil"
5
6
"os"
6
7
"regexp"
@@ -59,6 +60,8 @@ func initConfig() {
59
60
if url := os .Getenv ("RABBIT_URL" ); url != "" {
60
61
if valid , _ := regexp .MatchString ("https?://[a-zA-Z.0-9]+" , strings .ToLower (url )); valid {
61
62
config .RabbitURL = url
63
+ } else {
64
+ panic (fmt .Errorf ("Rabbit URL must start with http:// or https://" ))
62
65
}
63
66
}
64
67
@@ -95,6 +98,8 @@ func initConfig() {
95
98
if port := os .Getenv ("PUBLISH_PORT" ); port != "" {
96
99
if _ , err := strconv .Atoi (port ); err == nil {
97
100
config .PublishPort = port
101
+ } else {
102
+ panic (fmt .Errorf ("The configured port is not a valid number: %v" , port ))
98
103
}
99
104
100
105
}
You can’t perform that action at this time.
0 commit comments