Templates are not reflecting while created using shell script in Ubuntu
-
Hi Jan,
I have created a shell script that will deploy my Jsreport on Ubuntu machine in Azure.When I run the script everything went well and Jsreport Daemon service is also get created and it is running and all my Jsreport stuff is in jsreport folder and some templates are also configured by that script.
Issue is that I am not able to see those templates in jsreport studio.
My shell script create a testTemplate folder in jsreport/data folder where templates are stored and inside testTemplate folder script creates below files which are required for template.
-
config.json
{
"shortid": "Skg6lyHasL",
"name": "testTemplate",
"recipe": "text",
"engine": "jsrender",
"chrome": {
"printBackground": true
},
"creationDate": "2020-05-28T13:39:17.492Z",
"modificationDate": {
"5840date": 1590673209303
},
"_id": "0Kog3miLXUG9Qwsx",
"": "templates"
} -
helpers.js
some java script content
3.content.html
some html content
I know that, in config.json the property for templates must be this "$entitySet": "templates" but when my shell script is trying to create that file somehow that key "$entitySet" is getting removed and it looks like "": "templates" in config.json file.
Below is my part of shell script that creates that config.json file
cd /var/jsreport/
sudo rm -rf data/
mkdir data
cd /var/jsreport/data/
mkdir testTemplate
cat <<EOF >/var/jsreport/data/testTemplate/config.json
{
"shortid": "Skg6lyHasL",
"name": "testTemplate",
"recipe": "text",
"engine": "jsrender",
"chrome": {
"printBackground": true
},
"creationDate": "2020-05-28T13:39:17.492Z",
"modificationDate": {
"$$date": 1590673209303
},
"_id": "0Kog3miLXUG9Qwsx",
"$entitySet": "templates"
}
EOFAbove peace of script will create a folder testTemplate inside data folder and config.json file is also get created.
Can you help me why this key $entitySet is getting empty by shell script and we are getting like this "": "templates".
Thanks,
Zahid Khan
-
-
I would recommend checking this topic first, maybe it could be a better approach for you
https://jsreport.net/learn/fs-store#deploymentIn case you want to write to the data folder manually, please stop jsreport before doing so and then start it.
-
Thanks Jan for your comments I think the issue was with this cat command which ignores the character '$' while creating files. So I used '\' as a escape character for saving it and it worked perfectly.
cat <<EOF >/var/jsreport/data/testTemplate/config.json
{
"shortid": "Skg6lyHasL",
"name": "testTemplate",
"recipe": "text",
"engine": "jsrender",
"chrome": {
"printBackground": true
},
"creationDate": "2020-05-28T13:39:17.492Z",
"modificationDate": {
"\$\$date": 1590673209303
},
"_id": "0Kog3miLXUG9Qwsx",
"\$entitySet": "templates"
}
EOF