@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
57 lines (56 loc) • 2.1 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: Object.getOwnPropertyDescriptor(all, name).get
});
}
_export(exports, {
get configuration () {
return configuration;
},
get exportConfiguration () {
return exportConfiguration;
}
});
const _nodepath = require("node:path");
const _auth = require("../authentication/constants/auth");
const _functions = require("../common/functions");
const _configloader = require("./config.loader");
const _configvalidation = require("./config.validation");
const configuration = loadConfiguration();
const exportConfiguration = (reload = false)=>reload ? loadConfiguration() : configuration;
function loadConfiguration() {
const config = (0, _configloader.configLoader)();
// AUTHENTICATION
// CSRF & WS settings
config.auth.token.csrf = {
...config.auth.token.refresh,
name: _auth.CSRF_KEY
};
config.auth.token.ws = {
...config.auth.token.refresh,
name: _auth.WS_KEY
};
// APPLICATIONS CONFIGURATION
// SPACES & FILES
if (!config.applications.files.dataPath) {
throw new Error('dataPath is not defined in environment.yaml');
}
config.applications.files.usersPath = (0, _nodepath.join)(config.applications.files.dataPath, 'users');
config.applications.files.spacesPath = (0, _nodepath.join)(config.applications.files.dataPath, 'spaces');
config.applications.files.tmpPath = (0, _nodepath.join)(config.applications.files.dataPath, 'tmp');
return (0, _functions.transformAndValidate)(_configvalidation.Configuration, config, {
exposeDefaultValues: true
}, {
skipMissingProperties: false
});
}
//# sourceMappingURL=config.environment.js.map