seance/config.js

77 lines
1.7 KiB
JavaScript
Raw Normal View History

// load configuraton from .env file (if exists)
require('dotenv').config()
2020-04-24 12:50:18 -04:00
const convict = require('convict')
2020-04-24 12:50:18 -04:00
let config = convict({
webdav: {
server_url: {
doc: 'WebDAV server URL (eg. https://myhost.com:2078)',
format: 'url',
env: 'WEBDAV_SERVER_URL',
default: null,
},
username: {
doc: 'Username for WebDAV server',
format: 'String',
env: 'WEBDAV_USERNAME',
default: null,
},
password: {
doc: 'Password for WebDAV server',
format: 'String',
env: 'WEBDAV_PASSWORD',
default: null,
sensitive: true,
},
path_prefix: {
doc: 'Where to upload files (eg. /seance-uploads)',
format: 'String',
env: 'WEBDAV_PATH_PREFIX',
default: null,
},
uploaded_path_prefix: {
doc: 'URL where files are uploaded (eg. https://mysitem.com/media)',
format: 'url',
env: 'WEBDAV_UPLOADED_PATH_PREFIX',
default: null,
},
use_digest: {
doc: 'Whether to use digest authentication',
format: 'Boolean',
env: 'WEBDAV_USE_DIGEST',
default: false,
}
},
ghost: {
url: {
doc: 'URL of Ghost installation',
format: 'url',
env: 'GHOST_URL',
default: null,
},
version: {
format: 'String',
env: 'GHOST_VERSION',
default: 'v2',
},
admin_key: {
doc: 'Admin API key for Ghost',
format: 'String',
env: 'GHOST_ADMIN_KEY',
default: null,
sensitive: true,
}
},
scissors: {
doc: 'Separator image (for comparison)',
format: '*', // TODO: validate by checking path
env: 'SEPARATOR_IMAGE',
default: null,
}
})
2020-04-24 12:50:18 -04:00
config.validate()
module.exports = config.getProperties()