aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-02-23 18:26:34 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-02-23 18:26:34 -0800
commita9f0fdaf22459b338c4958083b2b52e674bdffca (patch)
tree0ea19824d21ee3cfff919c95b47b0540c1bb5a33
parent73a0a25b6cf9e2b11476c9b6504c69e7d33f4ccc (diff)
Print info message if DATABASE_URL is not set
-rw-r--r--cli/cli.go9
-rw-r--r--config/config.go13
2 files changed, 17 insertions, 5 deletions
diff --git a/cli/cli.go b/cli/cli.go
index 1e5a13a..a427073 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -28,6 +28,11 @@ func Parse() {
flag.Parse()
cfg := config.NewConfig()
+
+ if *flagDebugMode || cfg.HasDebugMode() {
+ logger.EnableDebug()
+ }
+
store := storage.NewStorage(
cfg.DatabaseURL(),
cfg.DatabaseMaxConnections(),
@@ -63,9 +68,5 @@ func Parse() {
return
}
- if *flagDebugMode || cfg.HasDebugMode() {
- logger.EnableDebug()
- }
-
daemon.Run(cfg, store)
}
diff --git a/config/config.go b/config/config.go
index 9bd673e..5bb9cb4 100644
--- a/config/config.go
+++ b/config/config.go
@@ -8,6 +8,8 @@ import (
"net/url"
"os"
"strconv"
+
+ "github.com/miniflux/miniflux/logger"
)
const (
@@ -89,7 +91,16 @@ func (c *Config) BasePath() string {
// DatabaseURL returns the database URL.
func (c *Config) DatabaseURL() string {
- return c.get("DATABASE_URL", defaultDatabaseURL)
+ value, exists := os.LookupEnv("DATABASE_URL")
+ if !exists {
+ logger.Info("The environment variable DATABASE_URL is not configured (the default value is used instead)")
+ }
+
+ if value == "" {
+ value = defaultDatabaseURL
+ }
+
+ return value
}
// DatabaseMaxConnections returns the number of maximum database connections.