aboutsummaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-04-15 20:27:10 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-04-15 21:07:59 -0700
commit0429bbb19db777bf5979df02ab21815b33541e7e (patch)
tree636dc7d41bdef8805e55e4d13ad7065958eb7c56 /config
parent45dde0cf4a5794f36fb278e24e2cd9899d03922a (diff)
Simplify Heroku deployment
Diffstat (limited to 'config')
-rw-r--r--config/config.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go
index 5bb9cb4..aae1d98 100644
--- a/config/config.go
+++ b/config/config.go
@@ -110,6 +110,10 @@ func (c *Config) DatabaseMaxConnections() int {
// ListenAddr returns the listen address for the HTTP server.
func (c *Config) ListenAddr() string {
+ if port := os.Getenv("PORT"); port != "" {
+ return ":" + port
+ }
+
return c.get("LISTEN_ADDR", defaultListenAddr)
}
@@ -183,6 +187,16 @@ func (c *Config) HasHSTS() bool {
return c.get("DISABLE_HSTS", "") == ""
}
+// RunMigrations returns true if the environment variable RUN_MIGRATIONS is not empty.
+func (c *Config) RunMigrations() bool {
+ return c.get("RUN_MIGRATIONS", "") != ""
+}
+
+// CreateAdmin returns true if the environment variable CREATE_ADMIN is not empty.
+func (c *Config) CreateAdmin() bool {
+ return c.get("CREATE_ADMIN", "") != ""
+}
+
// NewConfig returns a new Config.
func NewConfig() *Config {
return &Config{IsHTTPS: os.Getenv("HTTPS") != ""}