Skip to content

Commit

Permalink
Set HTTP config values from env vars (#220)
Browse files Browse the repository at this point in the history
Heroku expects the web process to dynamically set the listen port based
on the PORT variable. This, in combination with a .profile file to set
`PORT=BULLDOZER_PORT`, will make it easier to run Bulldozer in Heroku,
as well as allowing other HTTP-related config to be set via environment
variables.
  • Loading branch information
f1sherman committed Mar 18, 2021
1 parent 9d641cc commit c27b66a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config/bulldozer.example.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Options for the http server
server:
# The listen address and port
# The listen address. Can also be set by the BULLDOZER_ADDRESS environment
# variable.
address: "0.0.0.0"
# The listen port. Can also be set by the BULLDOZER_PORT environment
# variable.
port: 8080
# Uncomment the "tls_config" block to enable HTTPS support in the server.
# The cert and key files must be usable by net/http.ListenAndServeTLS().
# Cert and Key file can also be set by the BULLDOZER_TLS_CERT_FILE and
# BULLDOZER_TLS_KEY_FILE environment variables, respectively.
# tls_config:
# cert_file: /path/to/server.pem
# key_file: /path/to/server.key
Expand Down
1 change: 1 addition & 0 deletions server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func ParseConfig(bytes []byte) (*Config, error) {
}

c.Github.SetValuesFromEnv("")
c.Server.SetValuesFromEnv("BULLDOZER_")
if v, ok := os.LookupEnv("BULLDOZER_PUSH_RESTRICTION_USER_TOKEN"); ok {
c.Options.PushRestrictionUserToken = v
}
Expand Down

0 comments on commit c27b66a

Please sign in to comment.