1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-21 18:11:09 +00:00

Simplify Heroku deployment

This commit is contained in:
Frédéric Guillot 2018-04-15 20:27:10 -07:00
parent 45dde0cf4a
commit 0429bbb19d
3 changed files with 28 additions and 0 deletions

View file

@ -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") != ""}