feat: compute DOCS_URL in authDocUrl

This commit is contained in:
Ali BARIN
2024-04-23 12:21:51 +00:00
parent 754c2d41c2
commit 4da6e8372f
3 changed files with 10 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ export default defineApp({
baseUrl: 'https://gitlab.com', baseUrl: 'https://gitlab.com',
apiBaseUrl: 'https://gitlab.com', apiBaseUrl: 'https://gitlab.com',
iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg', iconUrl: '{BASE_URL}/apps/gitlab/assets/favicon.svg',
authDocUrl: 'https://automatisch.io/docs/apps/gitlab/connection', authDocUrl: '{DOCS_URL}/apps/gitlab/connection',
primaryColor: 'FC6D26', primaryColor: 'FC6D26',
supportsConnections: true, supportsConnections: true,
beforeRequest: [setBaseUrl, addAuthHeader], beforeRequest: [setBaseUrl, addAuthHeader],

View File

@@ -38,6 +38,9 @@ if (process.env.WEB_APP_URL) {
let webhookUrl = new URL(process.env.WEBHOOK_URL || apiUrl).toString(); let webhookUrl = new URL(process.env.WEBHOOK_URL || apiUrl).toString();
webhookUrl = webhookUrl.substring(0, webhookUrl.length - 1); webhookUrl = webhookUrl.substring(0, webhookUrl.length - 1);
const publicDocsUrl = 'https://automatisch.io/docs';
const docsUrl = process.env.DOCS_URL || publicDocsUrl;
const appEnv = process.env.APP_ENV || 'development'; const appEnv = process.env.APP_ENV || 'development';
const appConfig = { const appConfig = {
@@ -73,6 +76,7 @@ const appConfig = {
baseUrl: apiUrl, baseUrl: apiUrl,
webAppUrl, webAppUrl,
webhookUrl, webhookUrl,
docsUrl,
telemetryEnabled: process.env.TELEMETRY_ENABLED === 'false' ? false : true, telemetryEnabled: process.env.TELEMETRY_ENABLED === 'false' ? false : true,
requestBodySizeLimit: '1mb', requestBodySizeLimit: '1mb',
smtpHost: process.env.SMTP_HOST, smtpHost: process.env.SMTP_HOST,

View File

@@ -6,6 +6,11 @@ const appInfoConverter = (rawAppData) => {
appConfig.baseUrl appConfig.baseUrl
); );
rawAppData.authDocUrl = rawAppData.authDocUrl.replace(
'{DOCS_URL}',
appConfig.docsUrl
);
if (rawAppData.auth?.fields) { if (rawAppData.auth?.fields) {
rawAppData.auth.fields = rawAppData.auth.fields.map((field) => { rawAppData.auth.fields = rawAppData.auth.fields.map((field) => {
if (field.type === 'string' && typeof field.value === 'string') { if (field.type === 'string' && typeof field.value === 'string') {