fix: update environment variables names

This commit is contained in:
yassinedorbozgithub 2024-12-02 10:27:27 +01:00
parent a3bd044509
commit 65c52e645d
8 changed files with 13 additions and 11 deletions

View File

@ -75,7 +75,7 @@ const i18nOptions: I18nOptions = {
options: {
context: {
appName: config.parameters.appName,
appUrl: config.frontendPath,
appUrl: config.uiBaseUrl,
},
},
},

View File

@ -91,7 +91,7 @@ export class Attachment extends BaseSchema {
attachmentName: string = '',
): string {
return buildURL(
config.apiPath,
config.apiBaseUrl,
`/attachment/download/${attachmentId}/${attachmentName}`,
);
}
@ -124,7 +124,7 @@ export const AttachmentModel: ModelDefinition = LifecycleHookManager.attach({
AttachmentModel.schema.virtual('url').get(function () {
if (this._id && this.name)
return buildURL(
config.apiPath,
config.apiBaseUrl,
`/attachment/download/${this._id}/${this.name}`,
);

View File

@ -53,7 +53,7 @@ export class ContentStub extends BaseSchema {
* Helper to return the internal url of this content.
*/
static getUrl(item: ContentElement): string {
return new URL('/content/view/' + item.id, config.apiPath).toString();
return new URL('/content/view/' + item.id, config.apiBaseUrl).toString();
}
/**

View File

@ -15,8 +15,8 @@ export const config: Config = {
translationFilename: process.env.I18N_TRANSLATION_FILENAME || 'messages',
},
appPath: process.cwd(),
apiPath: process.env.API_ORIGIN || 'http://localhost:4000',
frontendPath: process.env.FRONTEND_ORIGIN
apiBaseUrl: process.env.API_ORIGIN || 'http://localhost:4000',
uiBaseUrl: process.env.FRONTEND_ORIGIN
? process.env.FRONTEND_ORIGIN.split(',')[0]
: 'http://localhost:8080',
security: {

View File

@ -27,8 +27,8 @@ type TCacheConfig = {
export type Config = {
i18n: { translationFilename: string };
appPath: string;
apiPath: string;
frontendPath: string;
apiBaseUrl: string;
uiBaseUrl: string;
security: {
httpsEnabled: boolean;
trustProxy: boolean;

View File

@ -20,7 +20,7 @@ export default [
{
group: CONSOLE_CHANNEL_NAMESPACE,
label: Web.SettingLabel.allowed_domains,
value: config.frontendPath,
value: config.uiBaseUrl,
type: SettingType.text,
},
{

View File

@ -49,7 +49,7 @@ export class IOMessagePipe implements PipeTransform<string, IOIncomingMessage> {
const url = message.url.startsWith('http')
? message.url
: `${config.apiPath}${message.url}`;
: `${config.apiBaseUrl}${message.url}`;
if (!URL.canParse(url)) {
throw new BadRequestException('Cannot parse url');

View File

@ -90,7 +90,9 @@ export class SocketRequest {
// Resolve the URL and path
const urlObj = new URL(
this.url.startsWith('http') ? this.url : `${config.apiPath}${this.url}`,
this.url.startsWith('http')
? this.url
: `${config.apiBaseUrl}${this.url}`,
);
this.path = urlObj.pathname || '/';