[System] config: Read default config.
* Config file in module path is the default config, this allows simpler user configs. * Default values also for test configuration
This commit is contained in:
parent
30305c26cc
commit
94ffc706e7
|
@ -1,101 +0,0 @@
|
|||
[FLASCHENGEIST]
|
||||
# Select authentication provider (builtin: auth_plain, auth_ldap)
|
||||
auth = "auth_plain"
|
||||
# Enable if you run flaschengeist behind a proxy, e.g. nginx + gunicorn
|
||||
#proxy = false
|
||||
# Set root path, prefixes all routes
|
||||
#root = /api
|
||||
# Set secret key
|
||||
secret_key = "V3ryS3cr3t"
|
||||
# Domain used by frontend
|
||||
#domain = "flaschengeist.local"
|
||||
|
||||
[LOGGING]
|
||||
file = "/tmp/flaschengeist-debug.log"
|
||||
# DEBUG INFO WARNING ERROR
|
||||
#level = "WARNING"
|
||||
|
||||
[DATABASE]
|
||||
user = "user"
|
||||
host = "127.0.0.1"
|
||||
password = "password"
|
||||
database = "database"
|
||||
|
||||
[auth_plain]
|
||||
enabled = true
|
||||
|
||||
#[auth_ldap]
|
||||
# enabled = true
|
||||
# host =
|
||||
# port =
|
||||
# bind_dn =
|
||||
# base_dn =
|
||||
# secret =
|
||||
# use_ssl =
|
||||
# admin_dn =
|
||||
# admin_dn =
|
||||
# default_gid =
|
||||
|
||||
[MESSAGES]
|
||||
welcome_subject = "Welcome to Flaschengeist {name}"
|
||||
welcome_text = '''
|
||||
Hello {name}!
|
||||
Welcome to Flaschengeist!
|
||||
|
||||
Your username is {username}, please set your password:
|
||||
{password_link}
|
||||
(If the link expires, please just use the Forgot-Password-function).
|
||||
|
||||
Have fun :)
|
||||
'''
|
||||
|
||||
password_subject = "Flaschengeist - Password reset"
|
||||
password_text = '''
|
||||
Hello {name}!
|
||||
There was a password reset request for username: {username}
|
||||
|
||||
To change your password, click on this link:
|
||||
{link}
|
||||
'''
|
||||
|
||||
password_changed_subject = "Flaschengeist - Password changed"
|
||||
password_changed_text = '''
|
||||
Hello {name}!
|
||||
Your password was changed for username: {username}
|
||||
|
||||
If this was not you, please contact the support.
|
||||
'''
|
||||
|
||||
##################
|
||||
# PLUGINS #
|
||||
##################
|
||||
|
||||
#[users]
|
||||
# always enabled
|
||||
#
|
||||
## allowed values: false, "managed", "public"
|
||||
## false: Disable registration
|
||||
## "managed": only users with matching permission are allowed to register new users
|
||||
## "public": Also unauthenticated users can register an account
|
||||
# registration = False
|
||||
|
||||
############################
|
||||
# Configuration of plugins #
|
||||
############################
|
||||
#[mail]
|
||||
# enabled = true
|
||||
# SERVER =
|
||||
# PORT =
|
||||
# USER =
|
||||
# PASSWORD =
|
||||
# MAIL =
|
||||
# SSL or STARTLS
|
||||
# CRYPT = SSL
|
||||
|
||||
[balance]
|
||||
enabled = true
|
||||
# Enable a default limit, will be set if no other limit is set
|
||||
# limit = -10.00
|
||||
|
||||
[geruecht]
|
||||
enabled = false
|
|
@ -21,10 +21,12 @@ def update_dict(d, u):
|
|||
return d
|
||||
|
||||
|
||||
def read_configuration():
|
||||
def read_configuration(test_config):
|
||||
global config
|
||||
paths = [_module_path]
|
||||
|
||||
paths = [_module_path, Path.home() / ".config"]
|
||||
if not test_config:
|
||||
paths.append(Path.home() / ".config")
|
||||
if "FLASCHENGEIST_CONF" in os.environ:
|
||||
paths.append(Path(os.environ.get("FLASCHENGEIST_CONF")))
|
||||
|
||||
|
@ -35,14 +37,14 @@ def read_configuration():
|
|||
update_dict(config, toml.load(source))
|
||||
except IOError:
|
||||
pass
|
||||
if test_config:
|
||||
update_dict(config, test_config)
|
||||
|
||||
|
||||
def configure_app(app, test_config=None):
|
||||
global config
|
||||
if test_config is None:
|
||||
read_configuration()
|
||||
else:
|
||||
update_dict(config, test_config)
|
||||
read_configuration(test_config)
|
||||
|
||||
# Always enable this builtin plugins!
|
||||
update_dict(config, {"auth": {"enabled": True}, "roles": {"enabled": True}, "users": {"enabled": True}})
|
||||
|
||||
|
|
16
readme.md
16
readme.md
|
@ -13,18 +13,22 @@ or if you want to also run the tests:
|
|||
|
||||
pip3 install --user ".[ldap,test]"
|
||||
|
||||
You will also need a MySQL driver, recommended drivers are
|
||||
- `mysqlclient`
|
||||
- `PyMySQL`
|
||||
|
||||
#### Windows
|
||||
Same as above, but for mysql you have to follow this guide:
|
||||
|
||||
https://www.radishlogic.com/coding/python-3/installing-mysqldb-for-python-3-in-windows/
|
||||
|
||||
### Configuration
|
||||
1. Rename `flaschengeist.example.toml` to `flaschengeist.toml`
|
||||
2. Move it to either
|
||||
1. the module path (where flaschegeist is installed)
|
||||
2. `~/.config/`
|
||||
3. A custom path and set environment variable `FLASCHENGEIST_CONF`
|
||||
3. Change at least the database parameters
|
||||
Configuration is done within the a `flaschengeist.toml`file, you can copy the one located inside the module path
|
||||
(where flaschegeist is installed) or create an empty one and place it inside either:
|
||||
1. `~/.config/`
|
||||
2. A custom path and set environment variable `FLASCHENGEIST_CONF`
|
||||
|
||||
Change at least the database parameters!
|
||||
|
||||
### Database installation
|
||||
run_flaschengeist install
|
||||
|
|
Loading…
Reference in New Issue