Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ENV PC_CONFIG_PATH="" \
PC_EMAIL_PORT="" \
PC_EMAIL_USER="" \
PC_EMAIL_PASSWORD="" \
PC_LISTEN_ADDR="0.0.0.0" \
PC_PORT=8080 \
PC_ASSETS_PATH=${WORKDIR}/assets \
PC_TLS_CERT="" \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Starts a Padlock Cloud server instance
#### Environment Variables, Flags, Configuration File Variables
| Environment Variable | Flag | Configuration File | Description |
|----------------------|------------------------|----------------------|----------------------------------------------|
| `PC_LISTEN_ADDR` | `--listen` | `server.listen_addr` | Address to listen on |
| `PC_PORT` | `--port` | `-p` | `server.port` | Port to listen on |
| `PC_ASSETS_PATH` | `--assets-path` | `server.assets_path` | Path to assets directory |
| `PC_TLS_CERT` | `--tls-cert` | `server.tls_cert` | Path to TLS certification file |
Expand Down
7 changes: 7 additions & 0 deletions padlockcloud/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ func NewCliApp() *CliApp {
Name: "runserver",
Usage: "Starts a Padlock Cloud server instance",
Flags: []cli.Flag{
cli.StringFlag{
Name: "listen-addr",
Usage: "Address to listen on",
Value: "",
EnvVar: "PC_LISTEN_ADDR",
Destination: &config.Server.ListenAddr,
},
cli.IntFlag{
Name: "port, p",
Usage: "Port to listen on",
Expand Down
5 changes: 4 additions & 1 deletion padlockcloud/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func (d *DataStore) Serialize() ([]byte, error) {
type ServerConfig struct {
// Path to assets directory; used for loading templates and such
AssetsPath string `yaml:"assets_path"`
// Address to listen on
ListenAddr string `yaml:"listen_addr"`
// Port to listen on
Port int `yaml:"port"`
// Path to TLS certificate
Expand Down Expand Up @@ -580,11 +582,12 @@ func (server *Server) Start() error {

server.InitHandler()

listenAddr := server.Config.ListenAddr
port := server.Config.Port
tlsCert := server.Config.TLSCert
tlsKey := server.Config.TLSKey

server.Addr = fmt.Sprintf(":%d", port)
server.Addr = fmt.Sprintf("%s:%d", listenAddr, port)

// Start server
if tlsCert != "" && tlsKey != "" {
Expand Down