Ziya/app.config.ts
rizary 67fb3a203e
feat: implement CEX analysis cards and real-time token monitoring
- Add TokenCard and CexAnalysisCard components for displaying token data
- Implement real-time Redis event streaming for token updates
- Add environment-based configuration system for dev/prod Redis servers
- Create comprehensive hunting ground dashboard with card management
- Add individual and bulk card removal functionality
- Implement browser integration for token details viewing
- Add timestamp utilities and proper type handling for Redis events
- Create production-ready configuration with 154.38.185.112 Redis server
- Add comprehensive documentation in README.md and CONTRIBUTORS.md
- Restructure project architecture with proper Electron-Vue integration

BREAKING CHANGE: Redis configuration now uses environment-based settings
2025-06-23 09:03:39 +07:00

169 lines
No EOL
3.2 KiB
TypeScript

/**
* Ziya Application Configuration
* Centralized configuration for all app settings
*/
export interface AppConfig {
app: {
name: string;
version: string;
description: string;
author: string;
};
development: {
nuxt: {
host: string;
port: number;
https: boolean;
};
electron: {
devTools: boolean;
reloadOnChange: boolean;
};
};
production: {
electron: {
devTools: boolean;
};
};
window: {
minHeight: number;
minWidth: number;
maxHeight: number;
maxWidth: number;
defaultHeight: number;
defaultWidth: number;
titleBarStyle: 'default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover';
};
theme: {
defaultPalette: number;
defaultDarkMode: boolean;
availablePalettes: number[];
};
redis: {
host: string;
port: number;
db: number;
keyPrefix: string;
};
security: {
csp: {
scriptSrc: string[];
styleSrc: string[];
imgSrc: string[];
};
};
}
/**
* Default configuration
*/
export const appConfig: AppConfig = {
app: {
name: 'Ziya',
version: '1.0.0',
description: 'One stop shop trading solution',
author: 'bismillahDAO',
},
development: {
nuxt: {
host: 'localhost',
port: 3000,
https: false,
},
electron: {
devTools: true,
reloadOnChange: true,
},
},
production: {
electron: {
devTools: false,
},
},
window: {
minHeight: 800,
minWidth: 1080,
maxHeight: 1080,
maxWidth: 1920,
defaultHeight: 1024,
defaultWidth: 1280,
titleBarStyle: 'hidden',
},
theme: {
defaultPalette: 1,
defaultDarkMode: false,
availablePalettes: Array.from({ length: 24 }, (_, i) => i + 1),
},
redis: {
host: 'localhost',
port: 6379,
db: 0,
keyPrefix: 'ziya:',
},
security: {
csp: {
scriptSrc: ["'self'", "'unsafe-inline'"],
styleSrc: ["'self'", "'unsafe-inline'"],
imgSrc: ["'self'", 'data:', 'https:'],
},
},
};
/**
* Get configuration value with environment override support
*/
export function getConfig(): AppConfig {
// Allow environment variables to override config
const config = { ...appConfig };
// Override with environment variables if they exist
if (process.env.NUXT_DEV_PORT) {
config.development.nuxt.port = parseInt(process.env.NUXT_DEV_PORT, 10);
}
if (process.env.NUXT_DEV_HOST) {
config.development.nuxt.host = process.env.NUXT_DEV_HOST;
}
if (process.env.REDIS_HOST) {
config.redis.host = process.env.REDIS_HOST;
}
if (process.env.REDIS_PORT) {
config.redis.port = parseInt(process.env.REDIS_PORT, 10);
}
return config;
}
/**
* Get the development server URL
*/
export function getDevServerUrl(): string {
const config = getConfig();
const { host, port, https } = config.development.nuxt;
const protocol = https ? 'https' : 'http';
return `${protocol}://${host}:${port}`;
}
/**
* Environment-specific configuration helpers
*/
export const isDevelopment = process.env.NODE_ENV === 'development';
export const isProduction = process.env.NODE_ENV === 'production';
export const isElectron = process.env.IS_ELECTRON === 'true';
export default appConfig;