2022-12-13 04:45:38 +01:00
|
|
|
import { NextApiRequest, NextApiResponse } from 'next';
|
2022-08-29 05:20:54 +02:00
|
|
|
import { ok, methodNotAllowed } from 'next-basics';
|
2022-08-02 08:04:47 +02:00
|
|
|
|
2022-12-13 04:45:38 +01:00
|
|
|
export interface ConfigResponse {
|
|
|
|
basePath: string;
|
|
|
|
trackerScriptName: string;
|
|
|
|
updatesDisabled: boolean;
|
|
|
|
telemetryDisabled: boolean;
|
2023-02-28 05:03:04 +01:00
|
|
|
cloudMode: boolean;
|
2022-12-13 04:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse<ConfigResponse>) => {
|
2022-08-02 08:04:47 +02:00
|
|
|
if (req.method === 'GET') {
|
|
|
|
return ok(res, {
|
|
|
|
basePath: process.env.BASE_PATH || '',
|
|
|
|
trackerScriptName: process.env.TRACKER_SCRIPT_NAME,
|
|
|
|
updatesDisabled: !!process.env.DISABLE_UPDATES,
|
|
|
|
telemetryDisabled: !!process.env.DISABLE_TELEMETRY,
|
2023-04-12 22:41:00 +02:00
|
|
|
cloudMode: !!process.env.CLOUD_MODE,
|
2022-08-02 08:04:47 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return methodNotAllowed(res);
|
|
|
|
};
|