Rename base_url setting to public_url

This commit is contained in:
Alice Gaudon 2021-01-21 17:12:59 +01:00
parent 3e0a25874e
commit 784f2c976c
7 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@
verbose: true,
db_level: "ERROR",
},
base_url: "http://localhost:4899",
public_url: "http://localhost:4899",
public_websocket_url: "ws://localhost:4899",
listen_addr: '127.0.0.1',
port: 4899,

View File

@ -4,8 +4,8 @@
verbose: false,
db_level: "ERROR",
},
base_url: "https://watch-my.stream",
public_websocket_url: "wss://watch-my.stream",
public_url: "https://swaf.example",
public_websocket_url: "wss://swaf.example",
session: {
cookie: {
secure: true

View File

@ -38,7 +38,7 @@ export default abstract class Controller {
}
const queryStr = querystring.stringify(query);
return `${absolute ? config.get<string>('base_url') : ''}${path}` + (queryStr.length > 0 ? '?' + queryStr : '');
return `${absolute ? config.get<string>('public_url') : ''}${path}` + (queryStr.length > 0 ? '?' + queryStr : '');
}
private readonly router: Router = express.Router();

View File

@ -139,7 +139,7 @@ export default class AuthGuard {
if (!user.isApproved()) {
await new Mail(this.app.as(NunjucksComponent).getEnvironment(), PENDING_ACCOUNT_REVIEW_MAIL_TEMPLATE, {
username: (await user.mainEmail.get())?.getOrFail('email'),
link: config.get<string>('base_url') + Controller.route('accounts-approval'),
link: config.get<string>('public_url') + Controller.route('accounts-approval'),
}).send(config.get<string>('app.contact_email'));
}
}

View File

@ -43,7 +43,7 @@ export default class MagicLinkController<A extends Application> extends Controll
// Send email
await new Mail(app.as(NunjucksComponent).getEnvironment(), mailTemplate, Object.assign(data, {
link: `${config.get<string>('base_url')}${Controller.route('magic_link', undefined, {
link: `${config.get<string>('public_url')}${Controller.route('magic_link', undefined, {
id: link.id,
token: token,
})}`,

View File

@ -77,7 +77,7 @@ export default class BackendController extends Controller {
if (email && email.email) {
await new Mail(this.getApp().as(NunjucksComponent).getEnvironment(), ACCOUNT_REVIEW_NOTICE_MAIL_TEMPLATE, {
approved: true,
link: config.get<string>('base_url') + Controller.route('auth'),
link: config.get<string>('public_url') + Controller.route('auth'),
}).send(email.email);
}

View File

@ -105,7 +105,7 @@ export default class Mail {
// Set data
this.data.mail_subject = this.options.subject;
this.data.mail_to = this.options.to;
this.data.mail_link = config.get<string>('base_url') +
this.data.mail_link = config.get<string>('public_url') +
Controller.route('mail', [this.template.template], this.data);
this.data.app = config.get('app');