Reorganize many root config parameters
This commit is contained in:
parent
7ccd335649
commit
0f415144dc
@ -1,19 +1,39 @@
|
|||||||
{
|
{
|
||||||
|
asset_cache: false,
|
||||||
|
gitlab_webhook_token: 'default',
|
||||||
app: {
|
app: {
|
||||||
|
listen_addr: '127.0.0.1',
|
||||||
|
port: 4899,
|
||||||
|
public_url: "http://localhost:4899",
|
||||||
|
public_websocket_url: "ws://localhost:4899",
|
||||||
name: 'Example App',
|
name: 'Example App',
|
||||||
contact_email: 'contact@example.net',
|
contact_email: 'contact@example.net',
|
||||||
display_email_warning: true,
|
display_email_warning: true,
|
||||||
},
|
},
|
||||||
|
auth: {
|
||||||
|
// Registered accounts need to be approved by an administrator
|
||||||
|
approval_mode: false,
|
||||||
|
// 30 days
|
||||||
|
name_change_wait_period: 2592000000,
|
||||||
|
},
|
||||||
log: {
|
log: {
|
||||||
level: "DEBUG",
|
level: "DEBUG",
|
||||||
verbose: true,
|
verbose: true,
|
||||||
db_level: "ERROR",
|
db_level: "ERROR",
|
||||||
},
|
},
|
||||||
public_url: "http://localhost:4899",
|
magic_link: {
|
||||||
public_websocket_url: "ws://localhost:4899",
|
validity_period: 20,
|
||||||
listen_addr: '127.0.0.1',
|
},
|
||||||
port: 4899,
|
mail: {
|
||||||
gitlab_webhook_token: 'default',
|
host: "127.0.0.1",
|
||||||
|
port: "1025",
|
||||||
|
secure: false,
|
||||||
|
username: "",
|
||||||
|
password: "",
|
||||||
|
allow_invalid_tls: true,
|
||||||
|
from: 'contact@example.net',
|
||||||
|
from_name: 'Example App',
|
||||||
|
},
|
||||||
mysql: {
|
mysql: {
|
||||||
connectionLimit: 10,
|
connectionLimit: 10,
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
@ -35,28 +55,8 @@
|
|||||||
maxAge: 31557600000,
|
maxAge: 31557600000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mail: {
|
|
||||||
host: "127.0.0.1",
|
|
||||||
port: "1025",
|
|
||||||
secure: false,
|
|
||||||
username: "",
|
|
||||||
password: "",
|
|
||||||
allow_invalid_tls: true,
|
|
||||||
from: 'contact@example.net',
|
|
||||||
from_name: 'Example App',
|
|
||||||
},
|
|
||||||
view: {
|
view: {
|
||||||
cache: false,
|
cache: false,
|
||||||
dev: true,
|
dev: true,
|
||||||
},
|
},
|
||||||
asset_cache: false,
|
|
||||||
magic_link: {
|
|
||||||
validity_period: 20,
|
|
||||||
},
|
|
||||||
auth: {
|
|
||||||
// Registered accounts need to be approved by an administrator
|
|
||||||
approval_mode: false,
|
|
||||||
// 30 days
|
|
||||||
name_change_wait_period: 2592000000,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,28 @@
|
|||||||
{
|
{
|
||||||
|
asset_cache: true,
|
||||||
|
app: {
|
||||||
|
public_url: "https://swaf.example",
|
||||||
|
public_websocket_url: "wss://swaf.example",
|
||||||
|
},
|
||||||
log: {
|
log: {
|
||||||
level: "DEV",
|
level: "DEV",
|
||||||
verbose: false,
|
verbose: false,
|
||||||
db_level: "ERROR",
|
db_level: "ERROR",
|
||||||
},
|
},
|
||||||
public_url: "https://swaf.example",
|
magic_link: {
|
||||||
public_websocket_url: "wss://swaf.example",
|
validity_period: 900,
|
||||||
session: {
|
|
||||||
cookie: {
|
|
||||||
secure: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mail: {
|
mail: {
|
||||||
secure: true,
|
secure: true,
|
||||||
allow_invalid_tls: false,
|
allow_invalid_tls: false,
|
||||||
},
|
},
|
||||||
magic_link: {
|
session: {
|
||||||
validity_period: 900,
|
cookie: {
|
||||||
|
secure: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
cache: true,
|
cache: true,
|
||||||
dev: false,
|
dev: false,
|
||||||
},
|
}
|
||||||
asset_cache: true,
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
auth: {
|
||||||
|
approval_mode: true,
|
||||||
|
},
|
||||||
mysql: {
|
mysql: {
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
user: "root",
|
user: "root",
|
||||||
@ -12,7 +15,4 @@
|
|||||||
maxAge: 1000,
|
maxAge: 1000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
auth: {
|
|
||||||
approval_mode: true,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ export default class MagicLinkController<A extends Application> extends Controll
|
|||||||
email: link.getOrFail('email'),
|
email: link.getOrFail('email'),
|
||||||
type: link.getOrFail('action_type'),
|
type: link.getOrFail('action_type'),
|
||||||
validUntil: link.getExpirationDate().getTime(),
|
validUntil: link.getExpirationDate().getTime(),
|
||||||
websocketUrl: config.get<string>('public_websocket_url') + this.magicLinkWebsocketPath,
|
websocketUrl: config.get<string>('app.public_websocket_url') + this.magicLinkWebsocketPath,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ export default class MailComponent extends ApplicationComponent {
|
|||||||
// Set locals
|
// Set locals
|
||||||
locals.mail_subject = options.subject;
|
locals.mail_subject = options.subject;
|
||||||
locals.mail_to = options.to;
|
locals.mail_to = options.to;
|
||||||
locals.mail_link = config.get<string>('public_url') +
|
locals.mail_link = config.get<string>('app.public_url') +
|
||||||
route('mail', [template.template], locals);
|
route('mail', [template.template], locals);
|
||||||
Object.assign(locals, this.getApp().as(FrontendToolsComponent).getGlobals().get());
|
Object.assign(locals, this.getApp().as(FrontendToolsComponent).getGlobals().get());
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export default class WebSocketServerComponent extends ApplicationComponent {
|
|||||||
|
|
||||||
const globals = app.asOptional(FrontendToolsComponent)?.getGlobals();
|
const globals = app.asOptional(FrontendToolsComponent)?.getGlobals();
|
||||||
if (globals) {
|
if (globals) {
|
||||||
globals.set('websocketUrl', config.get('public_websocket_url'));
|
globals.set('websocketUrl', config.get('app.public_websocket_url'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import TestApp from "./TestApp.js";
|
|||||||
|
|
||||||
const packageJson = JSON.parse((await fs.readFile('package.json')).toString());
|
const packageJson = JSON.parse((await fs.readFile('package.json')).toString());
|
||||||
|
|
||||||
const app = new TestApp(packageJson.version, config.get<string>('listen_addr'), config.get<number>('port'));
|
const app = new TestApp(packageJson.version, config.get<string>('app.listen_addr'), config.get<number>('app.port'));
|
||||||
await app.start();
|
await app.start();
|
||||||
})().catch(err => {
|
})().catch(err => {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user