Commit 7885316c authored by sim's avatar sim

Can change path of Gargantext config file

parent 5f73fcdc
import os
from configparser import RawConfigParser
from decouple import AutoConfig, RepositoryIni
SEARCH_PATH, GARGANTEXT_CONF = \
os.path.split(os.environ.get('GARGANTEXT_CONF', 'gargantext.ini'))
class GargantextIni(RepositoryIni):
SECTION = 'django'
......@@ -12,7 +17,7 @@ class GargantextIni(RepositoryIni):
class GargantextConfig(AutoConfig):
SUPPORTED = {'gargantext.ini': GargantextIni}
SUPPORTED = {GARGANTEXT_CONF: GargantextIni}
config = GargantextConfig(search_path='.')
config = GargantextConfig(search_path=SEARCH_PATH or '.')
#!/bin/sh
#!/usr/bin/env bash
echo "# Automatically generated file, local changes may be overwritten" > .env
echo "DJANGO_SETTINGS_MODULE=gargantext.settings" >> .env
ENV_FILE=.env
read -r -d '' DJANGO_VAR <<EOF
# Django settings module, it is unlikely that you'll need to change that
DJANGO_SETTINGS_MODULE=gargantext.settings
EOF
build_env () {
cat << EOF > $ENV_FILE
$DJANGO_VAR
# Path to gargantext configuration file, you're welcome to change that; when
# a simple filename is given, it'll be searched in current directory
GARGANTEXT_CONF=gargantext.ini
EOF
}
update_env () {
grep -Eq '^\s*DJANGO_SETTINGS_MODULE\s*=' "$ENV_FILE" || echo "$DJANGO_VAR" >> "$ENV_FILE"
}
[ -f "$ENV_FILE" ] && update_env || build_env
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