Skip to content

Commit 2b9f070

Browse files
committed
chore: update config
1 parent 415d07d commit 2b9f070

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

docusaurus.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from './docusaurus-common.config';
2020
import ogImageGenerator from './plugins/og-image-generator';
2121
import tutorialGenerator from './plugins/tutorial-generator';
22+
import { yes } from '@silverhand/essentials';
2223

2324
const getLogtoDocsUrl = () =>
2425
isCfPagesPreview
@@ -53,6 +54,7 @@ const config: Config = {
5354
customFields: {
5455
inkeepApiKey: process.env.INKEEP_API_KEY,
5556
logtoApiBaseUrl: process.env.LOGTO_API_BASE_URL,
57+
isDevFeatureEnabled: yes(process.env.IS_DEV_FEATURE_ENABLED),
5658
},
5759

5860
staticDirectories: ['static', 'static-localized/' + currentLocale],

src/theme/Layout/index.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,21 @@ const CACHE_EXPIRY_KEY = '_logto_google_one_tap_config_expiry';
2929
const CACHE_EXPIRY_TIME = 1 * 60 * 60 * 1000; // 1 hour
3030

3131
// Default API base URL
32-
const DEFAULT_API_BASE_URL = 'https://auth.logto.io';
32+
const DEFAULT_API_BASE_PROD_URL = 'https://auth.logto.io';
33+
const DEFAULT_API_BASE_DEV_URL = 'https://auth.logto.dev';
3334

3435
export default function LayoutWrapper(props: Props): ReactNode {
3536
const [config, setConfig] = useState<GoogleOneTapConfig | undefined>(undefined);
3637
const { siteConfig } = useDocusaurusContext();
3738

3839
// Get the API base URL from customFields, or use the default value if it doesn't exist
3940
const logtoApiBaseUrl = siteConfig.customFields?.logtoApiBaseUrl;
40-
const apiBaseUrl = typeof logtoApiBaseUrl === 'string' ? logtoApiBaseUrl : DEFAULT_API_BASE_URL;
41+
const apiBaseUrl =
42+
typeof logtoApiBaseUrl === 'string'
43+
? logtoApiBaseUrl
44+
: siteConfig.customFields?.isDevFeatureEnabled
45+
? DEFAULT_API_BASE_DEV_URL
46+
: DEFAULT_API_BASE_PROD_URL;
4147

4248
useEffect(() => {
4349
const fetchConfig = async () => {

0 commit comments

Comments
 (0)