df6f398efc
* snap: Store media in the proper directory * snap/set-environment: Exit successfully when not enabled. This lets us unconditionally run things under `set-environment` and let it handle the case where the necessary configuration hasn't yet been set. * snap: Set the version based on git tags This will make the version something like `0.3.0-alpha-2-65-g29178aa` at the moment, as that was the most recent tag, but the commit tagged as `0.4.0` will get *that* as the version * snap: Force-install cargo-web This makes building the *second* time work; otherwise there might be an existing cargo-web install, and cargo will refuse to overwrite it.
31 lines
791 B
Bash
Executable File
31 lines
791 B
Bash
Executable File
#!/bin/sh
|
|
|
|
enabled="$(snapctl get enabled)"
|
|
if [ -z "${enabled}" -o "${enabled}" != "true" ]
|
|
then
|
|
echo "Plume not yet enabled"
|
|
exit 0
|
|
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"
|
|
export MEDIA_UPLOAD_DIRECTORY="${SNAP_DATA}/media"
|
|
|
|
cd ${SNAP}
|
|
exec $@
|