@@ -18,32 +18,32 @@ pip install --upgrade pip > /dev/null 2>&1
1818printf " Installing requirements\n"
1919pip install -r requirements.txt > /dev/null 2>&1
2020
21- # First ensure the MongoDB exists and it's reachable, then check the only field required at boot up
22- printf " Ensure MongoDB\n"
23- IS_CONFIGURED=` mongo pythonregex --quiet --eval " db.configuration.find().length()" `
24- if [ $? != 0 ];
25- then
26- printf " \033[0;31mCan't connect to mongodb. Is it online?\033[0m\n"
27- exit 1
28- fi
29-
30- # The cookie_secret need to be configured before first run
31- SECRET=
32- if [ " ${IS_CONFIGURED} " = " 0" ];
21+ # Use environment variables instead of user entry
22+ # MongoDB should exists
23+ if [ " ${USE_DOCKER} " = " 0" ];
3324then
34- printf " Install new cookie_secret key. You may change it later\n"
35- SECRET=` date +%s | shasum -a 256 | base64 | head -c 32`
36- mongo pythonregex --quiet --eval " db.configuration.insert({key: 'secret_key', value: '${SECRET} '})" > /dev/null 2>&1
37- else
38- printf " The database is already configured\n"
39- SECRET=` mongo pythonregex --quiet --eval " db.configuration.find({key: 'secret_key'})[0].value" `
40- fi
25+ # First ensure the MongoDB exists and it's reachable, then check the only field required at boot up
26+ printf " Ensure MongoDB\n"
27+ IS_CONFIGURED=` mongo pythonregex --quiet --eval " db.configuration.find().length()" `
28+ if [ $? != 0 ];
29+ then
30+ printf " \033[0;31mCan't connect to mongodb. Is it online?\033[0m\n"
31+ exit 1
32+ fi
4133
42- # Use env instead of user entry
34+ # The cookie_secret need to be configured before first run
35+ SECRET=
36+ if [ " ${IS_CONFIGURED} " = " 0" ];
37+ then
38+ printf " Install new cookie_secret key. You may change it later\n"
39+ SECRET=` date +%s | shasum -a 256 | base64 | head -c 32`
40+ mongo pythonregex --quiet --eval " db.configuration.insert({key: 'secret_key', value: '${SECRET} '})" > /dev/null 2>&1
41+ else
42+ printf " The database is already configured\n"
43+ SECRET=` mongo pythonregex --quiet --eval " db.configuration.find({key: 'secret_key'})[0].value" `
44+ fi
4345
44- # Register admin user
45- if [ " ${USE_DOCKER} " = " 0" ];
46- then
46+ # Register admin user
4747 printf " \nEnter the admin user name: "
4848 ADMIN_USER=
4949 while [[ ${ADMIN_USER} = " " ]];
0 commit comments