Commit 4024bfb4 authored by sim's avatar sim

Rename TARGET to ENVIR to avoid confusion with makefile target

parent fecd5be8
......@@ -72,14 +72,14 @@ do:
Or for production (without dev dependencies and without `DEBUG` mode):
make TARGET=prod
make ENVIR=prod
If you want to specify custom paths for configuration files (by default
`gargantext.ini` and `postgrest.conf` in current directory), use `GARGANTEXT_CONF`
and `POSTGREST_CONF` environment variable. For example:
GARGANTEXT_CONF=/etc/gargantext/gargantext.ini \
POSTGREST_CONF=/etc/gargantext/postgrest.conf make TARGET=prod
POSTGREST_CONF=/etc/gargantext/postgrest.conf make ENVIR=prod
If everything is going well, you now have a clean virtualenv with every
packages you need to run Gargantext, and fresh configuration files.
......
POSTGREST_INIT=./tools/init.d/gargantext-postgrest
BACKEND_INIT=./tools/init.d/gargantext-testserver
ifeq ("$(TARGET)", "prod")
TARG=prod
ifeq ("$(ENVIR)", "prod")
PIPENV_ARGS=
else
TARG=dev
PIPENV_ARGS=--dev
endif
......@@ -40,7 +38,7 @@ migrate:
.PHONY: conf
conf:
@echo "• Setup gargantext configuration..."
./tools/mkconf.sh $(TARG)
./tools/mkconf.sh $(ENVIR)
@echo
.PHONY: checkdebian
......
......@@ -42,8 +42,8 @@ while :; do
shift
done
# Target can be dev or prod
TARGET="${1:-dev}"
# ENVIR can be dev or prod
ENVIR="${1:-dev}"
# Virtual environment directory
VENV=$(pipenv --venv)
......@@ -62,7 +62,7 @@ POSTGREST_TEMPLATE=tools/conf/postgrest.template.conf
if [ -f "$GARGANTEXT_CONF" -a -z "$FORCE" ]; then
echo -e "Configuration file $GARGANTEXT_CONF already exists, you may" \
"need to edit it.\nTo generate a new configuration anyway you" \
"can do: ./tools/mkconf.sh -f $TARGET"
"can do: ./tools/mkconf.sh -f $ENVIR"
exit
fi
......@@ -77,7 +77,7 @@ if ! (mkdir -p $D && touch $GARGANTEXT_CONF 2>/dev/null); then
fi
# Setup DEBUG mode for dev target
[ "$TARGET" = "prod" ] && DEBUG=False || DEBUG=True
[ "$ENVIR" = "prod" ] && DEBUG=False || DEBUG=True
echo "▸ Generate secret key for Django..."
SECRET_KEY=$(pipenv run python ./tools/gensecret.py 2>/dev/null)
......@@ -161,7 +161,7 @@ sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \
-e "s/[{]LOG_LEVEL[}]/$LOG_LEVEL/g" \
-e "s/[{]VENV[}]/$VENV/g" \
"$GARGANTEXT_TEMPLATE" > "$GARGANTEXT_CONF" \
&& echo "Configuration for $TARGET environment written successfully in" \
&& echo "Configuration for $ENVIR environment written successfully in" \
"$GARGANTEXT_CONF."
echo "▸ Generate configuration file for PostgREST from $POSTGREST_TEMPLATE..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment