remove obsolete settings.go and corresponding references
This commit is contained in:
parent
20214b636e
commit
4f5af51fe0
4 changed files with 16 additions and 33 deletions
9
examples/demo/env.in
Normal file
9
examples/demo/env.in
Normal file
|
@ -0,0 +1,9 @@
|
|||
# env.in - input (example file) for .env file
|
||||
|
||||
SCOPES_LOGLEVEL=debug
|
||||
#SCOPES_LOGLEVEL=warn
|
||||
SCOPES_SERVER_PORT=8123
|
||||
SCOPES_DOCROOT=~/html/public
|
||||
|
||||
SCOPES_SQLITE_CONNSTR=data/scopes.sqlite
|
||||
SCOPES_PGSQL_CONNSTR="user=testuser password=secret dbname=testdb"
|
|
@ -44,7 +44,8 @@ func Config() lib.Config {
|
|||
}
|
||||
|
||||
// collect here the names of fields that may be overridden via
|
||||
// explicit Override() or SCOPES_* environment settings.
|
||||
// explicit Overrides() or SCOPES_* environment settings
|
||||
// (via .env or explicit setting of environment variables).
|
||||
const (
|
||||
HOME = "home"
|
||||
LOGFILE = "logfile"
|
||||
|
@ -53,11 +54,3 @@ const (
|
|||
DOCROOT = "docroot"
|
||||
PGSQL_CONNSTR = "pgsql_connstr"
|
||||
)
|
||||
|
||||
// put something like this (without comment markup)
|
||||
// in separate (non-versioned) settings.go file:
|
||||
/*func Overrides() config.Settings {
|
||||
return config.Settings{
|
||||
SERVER_PORT: "8126",
|
||||
}
|
||||
}*/
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
)
|
||||
|
||||
func Config() lib.Config {
|
||||
//ovr := Overrides().Use
|
||||
ovr := config.Overrides("env-test").Use
|
||||
b := config.Base
|
||||
|
||||
|
@ -54,7 +53,8 @@ var (
|
|||
)
|
||||
|
||||
// collect here the names of fields that may be overridden via
|
||||
// explicit Override() or SCOPES_* environment settings.
|
||||
// explicit Overrides() or SCOPES_* environment settings
|
||||
// (via .env or explicit setting of environment variables).
|
||||
const (
|
||||
HOME = "home"
|
||||
LOGFILE = "logfile"
|
||||
|
@ -62,12 +62,3 @@ const (
|
|||
SERVER_PORT = "server_port"
|
||||
SERVER_URL = "server_url"
|
||||
)
|
||||
|
||||
// in a production scenario this should be put in a separate
|
||||
// file `settings.go` that should not be stored in code repository.
|
||||
func Overrides() config.Settings {
|
||||
return config.Settings{
|
||||
//HOME: "tests",
|
||||
LOGLEVEL: "debug",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
func ConfigSqlite() *sql.Cfg {
|
||||
ovr := OverridesSql().Use
|
||||
ovr := config.Overrides("env-test").Use
|
||||
return &sql.Cfg{
|
||||
Driver: "sqlite",
|
||||
Connstr: ovr("somefile.sqlite", SQLITE_CONNSTR),
|
||||
|
@ -14,7 +14,6 @@ func ConfigSqlite() *sql.Cfg {
|
|||
}
|
||||
|
||||
func ConfigPgsql() *sql.Cfg {
|
||||
//ovr := OverridesSql().Use
|
||||
ovr := config.Overrides("env-test").Use
|
||||
return &sql.Cfg{
|
||||
Driver: "postgres",
|
||||
|
@ -24,19 +23,10 @@ func ConfigPgsql() *sql.Cfg {
|
|||
}
|
||||
|
||||
// collect here the names of fields that may be overridden via
|
||||
// explicit Override() or SCOPES_* environment settings.
|
||||
// explicit Overrides() or SCOPES_* environment settings
|
||||
// (via .env or explicit setting of environment variables).
|
||||
const (
|
||||
SQLITE_CONNSTR = "sqlite_connstr"
|
||||
PGSQL_CONNSTR = "pgsql_connstr"
|
||||
PGSQL_SCHEMA = "pgsql_schema"
|
||||
)
|
||||
|
||||
// in a production scenario this should be put in a separate
|
||||
// file `settings.go` that should not be stored in code repository.
|
||||
func OverridesSql() config.Settings {
|
||||
return config.Settings{
|
||||
//SQLITE_CONNSTR: ":memory",
|
||||
SQLITE_CONNSTR: "data/scopes.sqlite",
|
||||
PGSQL_CONNSTR: "user=ccotest password=cco dbname=scpstest",
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue