[3/3] The config now also passed as environment variables.

Message ID 20171010135525.1102-3-jonatan.schlag@ipfire.org
State New
Headers show
Series
  • [1/3] Load configurations only if the config file exists
Related show

Commit Message

Jonatan Schlag Oct. 11, 2017, 12:55 a.m. UTC
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/buildservice/__init__.py | 6 ++++++
 1 file changed, 6 insertions(+)

Patch

diff --git a/src/buildservice/__init__.py b/src/buildservice/__init__.py
index 7a744f5..b9f3e65 100644
--- a/src/buildservice/__init__.py
+++ b/src/buildservice/__init__.py
@@ -74,6 +74,12 @@  class Backend(object):
 	def read_config(self, path):
 		c = ConfigParser.SafeConfigParser()
 
+		c.add_section("database")
+		c.set("database", "name", os.environ.get("PBS_DATABASE_NAME"))
+		c.set("database", "hostname", os.environ.get("PBS_DATABASE_HOSTNAME"))
+		c.set("database", "user", os.environ.get("PBS_DATABASE_USER"))
+		c.set("database", "password", os.environ.get("PBS_DATABASE_PASSWORD"))
+
 		# Load default configuration file first
 		paths = [
 			os.path.join(CONFIGSDIR, "pbs.conf"),