Commit 846b50e5 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Fix weboob data dir path for the self-hosted case;

parent 8af39836
......@@ -90,8 +90,9 @@ you can set several options at runtime:
- the default **host** on which Kresus listens is `localhost`. This can be
overriden with the env variable `HOST`.
- in standalone mode, the default install location is `~/.kresus/`. This can be
overriden with the env variable `KRESUS_DIR`.
- in standalone mode, the default data location is `~/.kresus/`. This is where
the database files and weboob modules are stored. This can be overriden with
the env variable `KRESUS_DIR`.
- in standalone mode, if Kresus' server isn't served from the root (e.g. it is
served from `example.com/link/to/my/kresus`), you can override the env
......
......@@ -5,9 +5,10 @@ var ospath = require('ospath');
var path = require('path');
var fs = require('fs');
var mainDir = process.env.KRESUS_DIR ? process.env.KRESUS_DIR
: path.join(ospath.home(), '.kresus');
process.env.KRESUS_DIR = process.env.KRESUS_DIR ||
path.join(ospath.home(), '.kresus');
var mainDir = process.env.KRESUS_DIR;
if (!fs.existsSync(mainDir)) {
fs.mkdirSync(mainDir);
}
......
......@@ -28,6 +28,8 @@ function callWeboob(command, access) {
let env = {};
if (process.env.KRESUS_WEBOOB_DIR)
env.WEBOOB_DIR = process.env.KRESUS_WEBOOB_DIR;
if (process.env.KRESUS_DIR)
env.KRESUS_DIR = process.env.KRESUS_DIR;
// Variables for PyExecJS, necessary for the Paypal module.
env.PATH = process.env.PATH;
......
......@@ -38,7 +38,11 @@ DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
# cwd is /build/server
err_path = os.path.join('shared', 'errors.json')
weboob_path = os.path.join('weboob', 'data')
if 'KRESUS_DIR' in os.environ:
weboob_path = os.path.join(os.environ['KRESUS_DIR'], 'weboob-data')
else:
weboob_path = os.path.join('weboob', 'data')
with file(err_path) as f:
j = json.loads(f.read())
......
Supports Markdown
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