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