@@ -26,6 +26,7 @@ import (
2626 "context"
2727 "fmt"
2828 "io/ioutil"
29+ "net/url"
2930 "os"
3031 "os/signal"
3132 "path/filepath"
8687 logService logging.Service
8788 showVersion bool
8889 id string
90+ advertisedEndpoint string
8991 agencySize int
9092 arangodPath string
9193 arangodJSPath string
@@ -192,7 +194,7 @@ func init() {
192194 pf .StringVar (& logDir , "log.dir" , getEnvVar ("LOG_DIR" , "" ), "Custom log file directory." )
193195 f .IntVar (& logRotateFilesToKeep , "log.rotate-files-to-keep" , defaultLogRotateFilesToKeep , "Number of files to keep when rotating log files" )
194196 f .DurationVar (& logRotateInterval , "log.rotate-interval" , defaultLogRotateInterval , "Time between log rotations (0 disables log rotation)" )
195-
197+ f . StringVar ( & advertisedEndpoint , "cluster.advertised-endpoint" , "" , "An external endpoint for the servers started by this Starter" )
196198 f .IntVar (& agencySize , "cluster.agency-size" , 3 , "Number of agents in the cluster" )
197199 f .BoolSliceVar (& startAgent , "cluster.start-agent" , nil , "should an agent instance be started" )
198200 f .BoolSliceVar (& startDBserver , "cluster.start-dbserver" , nil , "should a dbserver instance be started" )
@@ -568,6 +570,11 @@ func mustPrepareService(generateAutoKeyFile bool) (*service.Service, service.Boo
568570 log .Fatal ().Err (err ).Msgf ("Unsupport image pull policy '%s'" , dockerImagePullPolicy )
569571 }
570572
573+ // Sanity checking URL scheme on advertised endpoints
574+ if _ , err := url .Parse (advertisedEndpoint ); err != nil {
575+ log .Fatal ().Err (err ).Msgf ("Advertised cluster endpoint %s does not meet URL standards" , advertisedEndpoint )
576+ }
577+
571578 // Expand home-dis (~) in paths
572579 arangodPath = mustExpand (arangodPath )
573580 arangodJSPath = mustExpand (arangodJSPath )
@@ -707,6 +714,7 @@ func mustPrepareService(generateAutoKeyFile bool) (*service.Service, service.Boo
707714 ArangodPath : arangodPath ,
708715 ArangoSyncPath : arangoSyncPath ,
709716 ArangodJSPath : arangodJSPath ,
717+ AdvertisedEndpoint : advertisedEndpoint ,
710718 MasterPort : masterPort ,
711719 RrPath : rrPath ,
712720 DataDir : dataDir ,
0 commit comments