mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
disable api differently
This commit is contained in:
parent
886e5164fb
commit
b70e29433e
|
@ -58,15 +58,14 @@ function createApiRouter(
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadPublicApiVersions = async (): Promise<express.Router[]> => {
|
export const loadPublicApiVersions = async (): Promise<express.Router[]> => {
|
||||||
// const swaggerThemePath = path.join(__dirname, 'swaggerTheme.css');
|
const swaggerThemePath = path.join(__dirname, 'swaggerTheme.css');
|
||||||
// const folders = await fs.readdir(__dirname);
|
const folders = await fs.readdir(__dirname);
|
||||||
// const css = (await fs.readFile(swaggerThemePath)).toString();
|
const css = (await fs.readFile(swaggerThemePath)).toString();
|
||||||
// const versions = folders.filter((folderName) => folderName.startsWith('v'));
|
const versions = folders.filter((folderName) => folderName.startsWith('v'));
|
||||||
// const apiRouters: express.Router[] = [];
|
const apiRouters: express.Router[] = [];
|
||||||
// for (const version of versions) {
|
for (const version of versions) {
|
||||||
// const openApiPath = path.join(__dirname, version, 'openapi.yml');
|
const openApiPath = path.join(__dirname, version, 'openapi.yml');
|
||||||
// apiRouters.push(createApiRouter(version, openApiPath, __dirname, css));
|
apiRouters.push(createApiRouter(version, openApiPath, __dirname, css));
|
||||||
// }
|
}
|
||||||
// return apiRouters;
|
return apiRouters;
|
||||||
return [];
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -164,7 +164,7 @@ import {
|
||||||
isEmailSetUp,
|
isEmailSetUp,
|
||||||
isUserManagementEnabled,
|
isUserManagementEnabled,
|
||||||
} from './UserManagement/UserManagementHelper';
|
} from './UserManagement/UserManagementHelper';
|
||||||
import { loadPublicApiVersions } from './PublicApi';
|
// import { loadPublicApiVersions } from './PublicApi';
|
||||||
|
|
||||||
require('body-parser-xml')(bodyParser);
|
require('body-parser-xml')(bodyParser);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ class App {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!config.getEnv('publicApi.disabled')) {
|
if (!config.getEnv('publicApi.disabled')) {
|
||||||
this.app.use(`/${this.publicApiEndpoint}`, ...(await loadPublicApiVersions()));
|
// this.app.use(`/${this.publicApiEndpoint}`, ...(await loadPublicApiVersions()));
|
||||||
}
|
}
|
||||||
// Parse cookies for easier access
|
// Parse cookies for easier access
|
||||||
this.app.use(cookieParser());
|
this.app.use(cookieParser());
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { passwordResetNamespace as passwordResetEndpoints } from '../../../src/U
|
||||||
import { issueJWT } from '../../../src/UserManagement/auth/jwt';
|
import { issueJWT } from '../../../src/UserManagement/auth/jwt';
|
||||||
import { getLogger } from '../../../src/Logger';
|
import { getLogger } from '../../../src/Logger';
|
||||||
import { credentialsController } from '../../../src/api/credentials.api';
|
import { credentialsController } from '../../../src/api/credentials.api';
|
||||||
import { loadPublicApiVersions } from '../../../src/PublicApi/';
|
// import { loadPublicApiVersions } from '../../../src/PublicApi/';
|
||||||
import type { User } from '../../../src/databases/entities/User';
|
import type { User } from '../../../src/databases/entities/User';
|
||||||
import { Telemetry } from '../../../src/telemetry';
|
import { Telemetry } from '../../../src/telemetry';
|
||||||
import type { ApiPath, EndpointGroup, SmtpTestAccount } from './types';
|
import type { ApiPath, EndpointGroup, SmtpTestAccount } from './types';
|
||||||
|
@ -66,7 +66,7 @@ export async function initTestServer({
|
||||||
if (routerEndpoints.length) {
|
if (routerEndpoints.length) {
|
||||||
const map: Record<string, express.Router | express.Router[]> = {
|
const map: Record<string, express.Router | express.Router[]> = {
|
||||||
credentials: credentialsController,
|
credentials: credentialsController,
|
||||||
publicApi: await loadPublicApiVersions(),
|
// publicApi: await loadPublicApiVersions(),
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const group of routerEndpoints) {
|
for (const group of routerEndpoints) {
|
||||||
|
|
Loading…
Reference in a new issue