Template or copy configuration
- Create ormconfig.json
- Change to using a dictionary for environmental variables
Change-Id: Ic02e813040f5a2b3d1f9d411970365a8f7e9955e
diff --git a/templates/default.timesheetsdb.j2 b/templates/default.timesheetsdb.j2
index 749062c..e0aaadc 100644
--- a/templates/default.timesheetsdb.j2
+++ b/templates/default.timesheetsdb.j2
@@ -4,7 +4,6 @@
#}
# /etc/default/timesheetsdb
# {{ ansible_managed }}
-DATABASE_NAME = {{ timesheets_pg_db }}
-DATABASE_PORT = {{ timesheets_pg_db_port }}
-DATABASE_USER = {{ timesheets_pg_db_username }}
-DATABASE_PASS = {{ timesheets_pg_db_password }}
+{% for key, val in timesheets_env_vars.items() %}
+{{ key }}="{{ val }}"
+{% endfor %}
diff --git a/templates/ormconfig.json.j2 b/templates/ormconfig.json.j2
new file mode 100644
index 0000000..0f0cbc4
--- /dev/null
+++ b/templates/ormconfig.json.j2
@@ -0,0 +1,19 @@
+{#
+SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
+SPDX-License-Identifier: Apache-2.0
+#}
+[
+ {
+ "type": "postgres",
+ "host": "localhost",
+ "port": {{ timesheets_pg_db_port }},
+ "username": "{{ timesheets_pg_db_username }}",
+ "password": "{{ timesheets_pg_db_password }}",
+ "database": "{{ timesheets_pg_db }}",
+ "entities": ["dist/**/*.entity{ .ts,.js}"],
+ "synchronize": false,
+ "migrations": ["dist/migrations/*{.ts,.js}"],
+ "migrationsTableName": "migrations_typeorm",
+ "migrationsRun": true
+ }
+]