Skip to content

Commit 0bc73d3

Browse files
authored
chore(core): auth is now more explict opt in (event-catalog#1902)
* chore(core): auth is now more explict opt in * Create happy-gorillas-fold.md
1 parent b8730a9 commit 0bc73d3

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.changeset/happy-gorillas-fold.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@eventcatalog/core": patch
3+
---
4+
5+
chore(core): auth is now more explict opt in

eventcatalog/src/utils/feature.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ export const isMarkdownDownloadEnabled = () => config?.llmsTxt?.enabled ?? false
5151
export const isLLMSTxtEnabled = () => (config?.llmsTxt?.enabled || isEventCatalogChatEnabled()) ?? false;
5252

5353
export const isAuthEnabled = () => {
54+
const isAuthEnabledInCatalog = config?.auth?.enabled ?? false;
5455
const directory = process.env.PROJECT_DIR || process.cwd();
55-
const hasAuthConfig = fs.existsSync(join(directory, 'eventcatalog.auth.js'));
56-
return (hasAuthConfig && isSSR() && isEventCatalogScaleEnabled()) || false;
56+
const hasAuthConfigurationFile = fs.existsSync(join(directory, 'eventcatalog.auth.js'));
57+
return (isAuthEnabledInCatalog && hasAuthConfigurationFile && isSSR() && isEventCatalogScaleEnabled()) || false;
5758
};
5859

5960
export const isSSR = () => config?.output === 'server';

src/eventcatalog.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ type PagesConfiguration = {
5151
pages?: string[];
5252
};
5353

54+
type AuthConfig = {
55+
enabled: boolean;
56+
};
57+
5458
export interface Config {
5559
title: string;
5660
tagline: false;
@@ -64,6 +68,7 @@ export interface Config {
6468
host?: string;
6569
trailingSlash?: boolean;
6670
output?: 'server' | 'static';
71+
auth?: AuthConfig;
6772
rss?: {
6873
enabled: boolean;
6974
limit: number;

0 commit comments

Comments
 (0)