Add validation to defaultpermission in config
This commit is contained in:
parent
0a7adaf35d
commit
5375fe5779
1 changed files with 7 additions and 2 deletions
|
@ -24,8 +24,13 @@ var allowanonymous = process.env.HMD_ALLOW_ANONYMOUS ? (process.env.HMD_ALLOW_AN
|
||||||
|
|
||||||
var allowfreeurl = process.env.HMD_ALLOW_FREEURL ? (process.env.HMD_ALLOW_FREEURL === 'true') : !!config.allowfreeurl;
|
var allowfreeurl = process.env.HMD_ALLOW_FREEURL ? (process.env.HMD_ALLOW_FREEURL === 'true') : !!config.allowfreeurl;
|
||||||
|
|
||||||
var defaultpermission = process.env.HMD_DEFAULT_PERMISSION || config.defaultpermission || 'editable';
|
var permissions = ['editable', 'limited', 'locked', 'protected', 'private'];
|
||||||
defaultpermission = (!allowanonymous && defaultpermission == 'freely') ? 'editable' : defaultpermission;
|
if (allowanonymous) {
|
||||||
|
permissions.unshift('freely');
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultpermission = process.env.HMD_DEFAULT_PERMISSION || config.defaultpermission;
|
||||||
|
defaultpermission = permissions.indexOf(defaultpermission) != -1 ? defaultpermission : 'editable';
|
||||||
|
|
||||||
// db
|
// db
|
||||||
var dburl = config.dburl || process.env.HMD_DB_URL || process.env.DATABASE_URL;
|
var dburl = config.dburl || process.env.HMD_DB_URL || process.env.DATABASE_URL;
|
||||||
|
|
Loading…
Reference in a new issue