library-ts/node/users/UserManagementServerSetting...

48 lines
1.1 KiB
TypeScript

import { RegExpUtility } from "../../browser/text/RegExpUtitlity";
import { Files } from "../files/Files";
export class UserManagementServerSettings
{
// Server settings
url:string;
port:number = 8084;
corsURLs:string[] = [];
isDebugMode:boolean = false;
// Paths
rootPath:string;
userDBPath:string;
rolesPath:string;
// Geo-Lite Lib
geoLocationPath:string;
geoAccountID:string;
geoLicenseKey:string;
// Email
emailFrom:string;
// User settings
maxLogins:number = 5;
static makeAllPathsAbsolute( settings:UserManagementServerSettings )
{
settings.userDBPath = this._makePathAbsolute( settings.userDBPath, settings.rootPath );
settings.rolesPath = this._makePathAbsolute( settings.rolesPath, settings.rootPath );
settings.geoLocationPath = this._makePathAbsolute( settings.geoLocationPath, settings.rootPath );
}
protected static _makePathAbsolute( path:string, rootPath:string )
{
if ( path.indexOf( rootPath ) === 0 )
{
return path;
}
return Files.joinPaths( [ rootPath, path ] );
}
}