Add Snapcraft metadata and install/maintenance hooks (#666)
* Add Snapcraft metadata and install/maintenance hooks * Move set-environment script into snap/local * snap: Remove diesel-cli part. This *was* necessary as of 0.3.0, but now `plm migrations run` does the job. * snap: Add an actual description * snap: Add an 'enabled' config item. Don't try to run until enabled is set, and automatically run the migrations when we are enabled
This commit is contained in:
committed by
Igor Galić
parent
309e1200d0
commit
b5eecbf2e7
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
enabled="$(snapctl get enabled)"
|
||||
if [ -z "${enabled}" -o "${enabled}" != "true" ]
|
||||
then
|
||||
echo "Plume not yet enabled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export BASE_URL="$(snapctl get base-url)"
|
||||
database_type="$(snapctl get db.type)"
|
||||
|
||||
if [ z"${database_type}" = z"sqlite" ]
|
||||
then
|
||||
export DATABASE_URL=${SNAP_DATA}/plume.db
|
||||
export MIGRATION_DIR=migrations/sqlite
|
||||
else
|
||||
# Must be postgres, so must have set db.url
|
||||
export DATABASE_URL="$(snapctl get db.url)"
|
||||
export MIGRATION_DIRECTORY=migrations/postgres
|
||||
fi
|
||||
|
||||
ROCKET_ADDRESS="$(snapctl get listen.address)"
|
||||
ROCKET_PORT="$(snapctl get listen.port)"
|
||||
export ROCKET_SECRET_KEY="$(cat ${SNAP_COMMON}/rocket-secret-key)"
|
||||
export SEARCH_INDEX="${SNAP_DATA}/search_index"
|
||||
|
||||
cd ${SNAP}
|
||||
exec $@
|
||||
Reference in New Issue
Block a user