Tudor Stanciu 345ed9c68c Merged PR 109: Bitip project initialization - GeoIP lookup service with frontend interface
- feat: Implement GeoIP lookup service with frontend interface
- feat: Add dotenv dependency and configure environment variables; update rate limiter response handling
- refactor: Remove development Dockerfile and docker-compose for streamlined setup; update GeoIP service to use new MaxMind types
- chore: update dependencies and ESLint configuration
- feat: Add documentation for breaking changes and package updates after major version upgrades
- feat: Add environment configuration files and update module imports for ES module support
- feat: Update nodemon configuration and add register script for ES module support
- feat: Add .gitattributes file to enforce LF line endings and define text/binary file types
- feat: Implement graceful shutdown with timeout and update nodemon configuration
- feat: Update environment configuration and add detailed configuration guide
- feat: add frontend origin validation and update rate limits
- feat: add versioning arguments and detailed OCI image labels to Dockerfile
- feat: add version and release notes endpoints, update frontend to display release notes
- feat: Refactor App component to use React Router for navigation
- feat: Update navigation styles and remove unused type definitions for react-router-dom
- feat: Generate runtime configuration for frontend and serve env.js
- feat: Update dependencies, enhance ESLint configuration, and improve Vite setup
- refactor: Remove ensureTrailingSlash function and simplify basePath assignment in Vite config
2025-10-02 22:59:22 +00:00

45 lines
1.5 KiB
TypeScript

import { Config } from '../types/index.js';
import path from 'path';
import { config as dotenvConfig } from 'dotenv';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Load .env file from root directory
dotenvConfig({ path: path.join(__dirname, '../../../.env') });
export const config: Config = {
port: parseInt(process.env.PORT || '3000', 10),
basePath: process.env.BASE_PATH || '/',
maxmindDbPath: process.env.MAXMIND_DB_PATH || '/usr/share/GeoIP',
seqUrl: process.env.SEQ_URL,
seqApiKey: process.env.SEQ_API_KEY,
apiKeys: {
frontend: process.env.FRONTEND_API_KEY || 'frontend-default-key',
external: (process.env.EXTERNAL_API_KEYS || 'external-default-key')
.split(',')
.map(key => key.trim()),
},
frontendAllowedOrigins: (
process.env.FRONTEND_ALLOWED_ORIGINS || 'http://localhost:5173'
)
.split(',')
.map(origin => origin.trim()),
rateLimits: {
frontend: {
windowMs: parseInt(process.env.FRONTEND_RATE_WINDOW_MS || '60000', 10),
max: parseInt(process.env.FRONTEND_RATE_MAX || '30', 10),
},
external: {
windowMs: parseInt(process.env.EXTERNAL_RATE_WINDOW_MS || '60000', 10),
max: parseInt(process.env.EXTERNAL_RATE_MAX || '1000', 10),
},
},
batchLimit: parseInt(process.env.BATCH_LIMIT || '100', 10),
debounceMs: parseInt(process.env.DEBOUNCE_MS || '2000', 10),
};
export default config;