Files
makelore/electron/utils/config.ts
2026-07-29 17:22:35 +08:00

65 lines
1.4 KiB
TypeScript

/**
* Application Configuration
* Centralized configuration constants and helpers
*/
/**
* Port configuration
*/
export const PORTS = {
/** Makelore GUI development server port */
NIANCODE_DEV: 5173,
/** Makelore GUI production port (for reference) */
NIANCODE_GUI: 23333,
/** Local host API server port */
NIANCODE_HOST_API: 13210,
/** Local opencode runtime port */
OPENCODE_RUNTIME: 4096,
} as const;
/**
* Get port from environment or default
*/
export function getPort(key: keyof typeof PORTS): number {
const envKey = `NIANCODE_PORT_${key}`;
const envValue = process.env[envKey];
return envValue ? parseInt(envValue, 10) : PORTS[key];
}
/**
* Application paths
*/
export const APP_PATHS = {
/** Makelore configuration directory */
NIANCODE_CONFIG: '~/.niancode',
/** Log files directory */
LOGS: '~/.niancode/logs',
} as const;
/**
* Update channels
*/
export const UPDATE_CHANNELS = ['stable', 'beta', 'dev'] as const;
export type UpdateChannel = (typeof UPDATE_CHANNELS)[number];
/**
* Default update configuration
*/
export const UPDATE_CONFIG = {
/** Check interval in milliseconds (6 hours) */
CHECK_INTERVAL: 6 * 60 * 60 * 1000,
/** Default update channel */
DEFAULT_CHANNEL: 'stable' as UpdateChannel,
/** Auto download updates */
AUTO_DOWNLOAD: false,
/** Show update notifications */
SHOW_NOTIFICATION: true,
};