core: Allow configuring DB/auth from environment
authorJanne Koschinski <janne@kuschku.de>
Tue, 8 May 2018 21:49:11 +0000 (16:49 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 23 May 2018 22:33:28 +0000 (00:33 +0200)
commit79aa3994d78860c0b7a623a46ce44dffff988fd9
treeedd0e26236073ac34e472ebe74c4cad89dec9540
parent436cb365db846985ef5ce508cb5bf925cd903480
core: Allow configuring DB/auth from environment

Add support for environment variables to configure database and
authenticator backends.  This improves using Quassel in a container
-based system as no configuration file needs to be written.

Toggle use of environment variables via a new CLI switch,
'--config-from-environment', which will disregard the core settings
file (if it exists) and use environment variables instead.

New environment variables:
> Backend selection
DB_BACKEND = ["SQLite", "PostgreSQL"]
AUTH_AUTHENTICATOR = ["Database", "LDAP"]
> PostgreSQL connection properties
DB_PGSQL_USERNAME
DB_PGSQL_PASSWORD
DB_PGSQL_HOSTNAME
DB_PGSQL_PORT
DB_PGSQL_DATABASE
> LDAP connection properties
AUTH_LDAP_HOSTNAME
AUTH_LDAP_PORT
AUTH_LDAP_BIND_DN
AUTH_LDAP_BIND_PASSWORD
AUTH_LDAP_BASE_DN
AUTH_LDAP_FILTER
AUTH_LDAP_UID_ATTRIBUTE

Closes GH-341.
14 files changed:
src/common/main.cpp
src/core/abstractsqlstorage.cpp
src/core/abstractsqlstorage.h
src/core/authenticator.h
src/core/core.cpp
src/core/core.h
src/core/ldapauthenticator.cpp
src/core/ldapauthenticator.h
src/core/postgresqlstorage.cpp
src/core/postgresqlstorage.h
src/core/sqlauthenticator.cpp
src/core/sqlauthenticator.h
src/core/sqlitestorage.h
src/core/storage.h