Add internal/admin debug tools to config page
This commit is contained in:
parent
d345f0c374
commit
63e9ed6e3d
@ -14,7 +14,7 @@ import {
|
||||
import { Cameras, createCameraKey } from '@/camera';
|
||||
import { Tags } from '@/tag';
|
||||
import { FilmSimulation, FilmSimulations } from '@/simulation';
|
||||
import { ADMIN_DB_OPTIMIZE_ENABLED } from '@/site/config';
|
||||
import { ADMIN_SQL_DEBUG_ENABLED } from '@/site/config';
|
||||
import {
|
||||
GetPhotosOptions,
|
||||
getLimitAndOffsetFromOptions,
|
||||
@ -127,7 +127,7 @@ const safelyQueryPhotos = async <T>(
|
||||
}
|
||||
}
|
||||
|
||||
if (ADMIN_DB_OPTIMIZE_ENABLED && debugMessage) {
|
||||
if (ADMIN_SQL_DEBUG_ENABLED && debugMessage) {
|
||||
const time =
|
||||
(((new Date()).getTime() - start.getTime()) / 1000).toFixed(2);
|
||||
console.log(`Executing sql query: ${debugMessage} (${time} seconds)`);
|
||||
|
||||
@ -28,6 +28,7 @@ import SecretGenerator from './SecretGenerator';
|
||||
import CopyButton from '@/components/CopyButton';
|
||||
import { PiPaintBrushHousehold } from 'react-icons/pi';
|
||||
import { IoMdGrid } from 'react-icons/io';
|
||||
import { CgDebug } from 'react-icons/cg';
|
||||
|
||||
export default function SiteChecklistClient({
|
||||
// Storage
|
||||
@ -86,6 +87,11 @@ export default function SiteChecklistClient({
|
||||
isPublicApiEnabled,
|
||||
isPriorityOrderEnabled,
|
||||
isOgTextBottomAligned,
|
||||
// Internal
|
||||
areInternalToolsEnabled,
|
||||
areAdminDebugToolsEnabled,
|
||||
isAdminDbOptimizeEnabled,
|
||||
isAdminSqlDebugEnabled,
|
||||
// Misc
|
||||
baseUrl,
|
||||
commitSha,
|
||||
@ -657,6 +663,40 @@ export default function SiteChecklistClient({
|
||||
{renderEnvVars(['NEXT_PUBLIC_OG_TEXT_ALIGNMENT'])}
|
||||
</ChecklistRow>
|
||||
</Checklist>
|
||||
{areInternalToolsEnabled &&
|
||||
<Checklist
|
||||
title="Internal"
|
||||
icon={<CgDebug size={16} />}
|
||||
optional
|
||||
>
|
||||
<ChecklistRow
|
||||
title="Debug tools"
|
||||
status={areAdminDebugToolsEnabled}
|
||||
optional
|
||||
>
|
||||
Set environment variable to {'"1"'} to temporarily enable
|
||||
features like photo matting, baseline grid, etc.:
|
||||
{renderEnvVars(['ADMIN_DEBUG_TOOLS'])}
|
||||
</ChecklistRow>
|
||||
<ChecklistRow
|
||||
title="DB optimize"
|
||||
status={isAdminDbOptimizeEnabled}
|
||||
optional
|
||||
>
|
||||
Set environment variable to {'"1"'} to prevent
|
||||
homepages from seeding infinite scroll on load:
|
||||
{renderEnvVars(['ADMIN_DB_OPTIMIZE'])}
|
||||
</ChecklistRow>
|
||||
<ChecklistRow
|
||||
title="SQL debugging"
|
||||
status={isAdminSqlDebugEnabled}
|
||||
optional
|
||||
>
|
||||
Set environment variable to {'"1"'} to enable
|
||||
console output for all sql queries:
|
||||
{renderEnvVars(['ADMIN_SQL_DEBUG'])}
|
||||
</ChecklistRow>
|
||||
</Checklist>}
|
||||
</>}
|
||||
</div>
|
||||
<div className="pl-11 pr-2 sm:pr-11 mt-4 md:mt-7">
|
||||
|
||||
@ -4,7 +4,6 @@ import { makeUrlAbsolute, shortenUrl } from '@/utility/url';
|
||||
|
||||
// HARD-CODED GLOBAL CONFIGURATION
|
||||
export const SHOULD_PREFETCH_ALL_LINKS: boolean | undefined = undefined;
|
||||
export const SHOULD_DEBUG_SQL = false;
|
||||
|
||||
// META / SOURCE / DOMAINS
|
||||
export const SITE_TITLE =
|
||||
@ -228,6 +227,7 @@ export const OG_TEXT_BOTTOM_ALIGNMENT =
|
||||
|
||||
export const ADMIN_DEBUG_TOOLS_ENABLED = process.env.ADMIN_DEBUG_TOOLS === '1';
|
||||
export const ADMIN_DB_OPTIMIZE_ENABLED = process.env.ADMIN_DB_OPTIMIZE === '1';
|
||||
export const ADMIN_SQL_DEBUG_ENABLED = process.env.ADMIN_SQL_DEBUG === '1';
|
||||
|
||||
export const CONFIG_CHECKLIST_STATUS = {
|
||||
// Storage
|
||||
@ -307,6 +307,15 @@ export const CONFIG_CHECKLIST_STATUS = {
|
||||
isPublicApiEnabled: PUBLIC_API_ENABLED,
|
||||
isPriorityOrderEnabled: PRIORITY_ORDER_ENABLED,
|
||||
isOgTextBottomAligned: OG_TEXT_BOTTOM_ALIGNMENT,
|
||||
// Internal
|
||||
areInternalToolsEnabled: (
|
||||
ADMIN_DEBUG_TOOLS_ENABLED ||
|
||||
ADMIN_DB_OPTIMIZE_ENABLED ||
|
||||
ADMIN_SQL_DEBUG_ENABLED
|
||||
),
|
||||
areAdminDebugToolsEnabled: ADMIN_DEBUG_TOOLS_ENABLED,
|
||||
isAdminDbOptimizeEnabled: ADMIN_DB_OPTIMIZE_ENABLED,
|
||||
isAdminSqlDebugEnabled: ADMIN_SQL_DEBUG_ENABLED,
|
||||
// Misc
|
||||
baseUrl: BASE_URL,
|
||||
commitSha: VERCEL_GIT_COMMIT_SHA_SHORT,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user