mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
1d8e208c32
Related to: https://github.com/fleetdm/confidential/issues/5637 Changes: - Added a way to start a vulnerability dashboard with Docker. - Updated the folder readme to include instructions for starting the vulnerability dashboard with docker
32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
if [ -z "$sails_custom__fleetBaseUrl" ] && [ -z "$sails_custom__fleetApiToken" ]; then
|
|
echo 'ERROR: Missing environment variables. Please set "sails_custom__fleetApiToken" and "sails_custom__fleetBaseUrl" and and try starting this container again'
|
|
exit 1
|
|
elif [ -z "$sails_custom__fleetBaseUrl" ]; then
|
|
echo 'ERROR: Missing environment variables. Please set "sails_custom__fleetBaseUrl" and try starting this container again'
|
|
exit 1
|
|
elif [ -z "$sails_custom__fleetApiToken" ]; then
|
|
echo 'ERROR: Missing environment variables. Please set "sails_custom__fleetApiToken" and and try starting this container again'
|
|
exit 1
|
|
fi
|
|
|
|
# Check if the vulnerability dashboard has been initialized before
|
|
if [ ! -f "/usr/src/app/.initialized" ]; then
|
|
# if it hasn't, lift the app with in console mode with the --drop flag to create our databsae tables.
|
|
echo '.exit' | node ./node_modules/sails/bin/sails console --drop
|
|
|
|
touch /usr/src/app/.initialized
|
|
# run the `update-reports` script
|
|
node ./node_modules/sails/bin/sails run update-reports
|
|
fi
|
|
|
|
# Expose the container's ENV variables to cron
|
|
printenv >> /etc/environment
|
|
|
|
# Start cron
|
|
cron
|
|
|
|
# Start the vulnerability dashboard
|
|
exec node app.js
|