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: { options: {
context: { context: {
appName: config.parameters.appName, appName: config.parameters.appName,
appUrl: config.frontendPath, appUrl: config.uiBaseUrl,
}, },
}, },
}, },

View File

@ -91,7 +91,7 @@ export class Attachment extends BaseSchema {
attachmentName: string = '', attachmentName: string = '',
): string { ): string {
return buildURL( return buildURL(
config.apiPath, config.apiBaseUrl,
`/attachment/download/${attachmentId}/${attachmentName}`, `/attachment/download/${attachmentId}/${attachmentName}`,
); );
} }
@ -124,7 +124,7 @@ export const AttachmentModel: ModelDefinition = LifecycleHookManager.attach({
AttachmentModel.schema.virtual('url').get(function () { AttachmentModel.schema.virtual('url').get(function () {
if (this._id && this.name) if (this._id && this.name)
return buildURL( return buildURL(
config.apiPath, config.apiBaseUrl,
`/attachment/download/${this._id}/${this.name}`, `/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. * Helper to return the internal url of this content.
*/ */
static getUrl(item: ContentElement): string { 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', translationFilename: process.env.I18N_TRANSLATION_FILENAME || 'messages',
}, },
appPath: process.cwd(), appPath: process.cwd(),
apiPath: process.env.API_ORIGIN || 'http://localhost:4000', apiBaseUrl: process.env.API_ORIGIN || 'http://localhost:4000',
frontendPath: process.env.FRONTEND_ORIGIN uiBaseUrl: process.env.FRONTEND_ORIGIN
? process.env.FRONTEND_ORIGIN.split(',')[0] ? process.env.FRONTEND_ORIGIN.split(',')[0]
: 'http://localhost:8080', : 'http://localhost:8080',
security: { security: {

View File

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

View File

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

View File

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

View File

@ -90,7 +90,9 @@ export class SocketRequest {
// Resolve the URL and path // Resolve the URL and path
const urlObj = new URL( 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 || '/'; this.path = urlObj.pathname || '/';