File tree 4 files changed +13
-1
lines changed
4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ ENV PC_CONFIG_PATH="" \
29
29
PC_EMAIL_PORT="" \
30
30
PC_EMAIL_USER="" \
31
31
PC_EMAIL_PASSWORD="" \
32
+ PC_LISTEN_ADDR="0.0.0.0" \
32
33
PC_PORT=8080 \
33
34
PC_ASSETS_PATH=${WORKDIR}/assets \
34
35
PC_TLS_CERT="" \
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ Starts a Padlock Cloud server instance
49
49
#### Environment Variables, Flags, Configuration File Variables
50
50
| Environment Variable | Flag | Configuration File | Description |
51
51
| ----------------------| ------------------------| ----------------------| ----------------------------------------------|
52
+ | ` PC_LISTEN_ADDR ` | ` --listen ` | ` server.listen_addr ` | Address to listen on |
52
53
| ` PC_PORT ` | ` --port ` | ; ` -p ` | ` server.port ` | Port to listen on |
53
54
| ` PC_ASSETS_PATH ` | ` --assets-path ` | ` server.assets_path ` | Path to assets directory |
54
55
| ` PC_TLS_CERT ` | ` --tls-cert ` | ` server.tls_cert ` | Path to TLS certification file |
Original file line number Diff line number Diff line change @@ -290,6 +290,13 @@ func NewCliApp() *CliApp {
290
290
Name : "runserver" ,
291
291
Usage : "Starts a Padlock Cloud server instance" ,
292
292
Flags : []cli.Flag {
293
+ cli.StringFlag {
294
+ Name : "listen-addr" ,
295
+ Usage : "Address to listen on" ,
296
+ Value : "" ,
297
+ EnvVar : "PC_LISTEN_ADDR" ,
298
+ Destination : & config .Server .ListenAddr ,
299
+ },
293
300
cli.IntFlag {
294
301
Name : "port, p" ,
295
302
Usage : "Port to listen on" ,
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ func (d *DataStore) Serialize() ([]byte, error) {
82
82
type ServerConfig struct {
83
83
// Path to assets directory; used for loading templates and such
84
84
AssetsPath string `yaml:"assets_path"`
85
+ // Address to listen on
86
+ ListenAddr string `yaml:"listen_addr"`
85
87
// Port to listen on
86
88
Port int `yaml:"port"`
87
89
// Path to TLS certificate
@@ -580,11 +582,12 @@ func (server *Server) Start() error {
580
582
581
583
server .InitHandler ()
582
584
585
+ listenAddr := server .Config .ListenAddr
583
586
port := server .Config .Port
584
587
tlsCert := server .Config .TLSCert
585
588
tlsKey := server .Config .TLSKey
586
589
587
- server .Addr = fmt .Sprintf (":%d" , port )
590
+ server .Addr = fmt .Sprintf ("%s :%d" , listenAddr , port )
588
591
589
592
// Start server
590
593
if tlsCert != "" && tlsKey != "" {
You can’t perform that action at this time.
0 commit comments