Commit 1beb6f80 authored by Lars Kruse's avatar Lars Kruse
Browse files

feat(database): add support for sqlite database

An sqlite database is much easier to setup for simple local deployments
and specifically for test automation.
parent d041f86c
Pipeline #1107 passed with stage
in 2 minutes and 4 seconds
......@@ -108,15 +108,19 @@ class AuraConfig:
Retrieves the database connection string.
"""
db_name = str(self.get("db_name"))
db_type = str(self.get("db_type"))
if db_type in {"mysql", "postgresql"}:
db_user = str(self.get("db_user"))
db_pass = str(self.get("db_pass"))
db_host = str(self.get("db_host"))
db_type = str(self.get("db_type"))
db_charset = self.get("db_charset", "utf8")
if db_type == "mysql":
return "mysql://" + db_user + ":" + db_pass + "@" + db_host + "/" + db_name + "?charset=" + db_charset
elif db_type == "postgresql":
return f"mysql://{db_user}:{db_pass}@{db_host}/{db_name}?charset={db_charset}"
else:
return f"postgresql+psycopg2://{db_user}:{db_pass}@{db_host}/{db_name}?client_encoding={db_charset}"
elif db_type == "sqlite":
# "db_name" is expected to be either a relative or an absolute path to the sqlite file
return f"sqlite:///{db_name}"
else:
return f"Error: invalid database type '{db_type}'"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment