Created
January 28, 2016 22:53
-
-
Save cilkay/f147956725003fd50bbe to your computer and use it in GitHub Desktop.
This is a JSON configuration file for LoopBack. The intention of determining whether the database exists or not is to either create it if does not via LoopBack's autoMigrate() function and update it if does via LoopBack's autoUpdate() function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"db": { | |
"connector": "memory", | |
"name": "db" | |
}, | |
"mctAudit": { | |
"connector": "mssql", | |
"port": "{{ grains['audit_dbms_port'] }}", | |
"host": "{{ grains['audit_dbms_hostname'] }}", | |
"database": "{{ grains['audit_dbms_db'] }}", | |
"user": "{{ grains['audit_dbms_username'] }}", | |
"password": "{{ grains['audit_dbms_pw'] }}", | |
"debug": false, | |
"autoMigrate": "{% if not postgres.db_exists '{{ grains['audit_dbms_db'] }}' %}", | |
"autoUpdate": "{% if postgres.db_exists '{{ grains['audit_dbms_db'] }}' %}" | |
}, | |
} | |
#### The above throws the following exception when the state is executed. #### | |
---------- | |
ID: datasources | |
Function: file.managed | |
Name: /home/cds/tcmweb/api-server/server/datasources.json | |
Result: False | |
Comment: Unable to manage file: Jinja syntax error: expected token 'end of statement block', got 'string'; line 24 | |
--- | |
[...] | |
"host": "{{ grains['audit_dbms_hostname'] }}", | |
"database": "{{ grains['audit_dbms_db'] }}", | |
"user": "{{ grains['audit_dbms_username'] }}", | |
"password": "{{ grains['audit_dbms_pw'] }}", | |
"debug": false, | |
"autoMigrate": "{% if not postgres.db_exists '{{ grains['audit_dbms_db'] }}' %}", <====================== | |
"autoUpdate": "{% if postgres.db_exists '{{ grains['audit_dbms_db'] }}' %}" | |
}, | |
"util": { | |
"connector": "postgresql", | |
"port": "5432", | |
[...] | |
--- | |
Started: 18:59:56.414136 | |
Duration: 22.641 ms | |
Changes: | |
---------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment