create-fluxstack 1.0.22 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/app/server/backend-only.ts +5 -5
  2. package/app/server/index.ts +63 -54
  3. package/app/server/live/FluxStackConfig.ts +43 -39
  4. package/app/server/live/SystemMonitorIntegration.ts +2 -2
  5. package/app/server/live/register-components.ts +6 -26
  6. package/app/server/middleware/errorHandling.ts +6 -4
  7. package/app/server/routes/config.ts +145 -0
  8. package/app/server/routes/index.ts +5 -3
  9. package/config/app.config.ts +113 -0
  10. package/config/build.config.ts +24 -0
  11. package/config/database.config.ts +99 -0
  12. package/config/index.ts +68 -0
  13. package/config/logger.config.ts +27 -0
  14. package/config/runtime.config.ts +92 -0
  15. package/config/server.config.ts +46 -0
  16. package/config/services.config.ts +130 -0
  17. package/config/system.config.ts +105 -0
  18. package/core/build/bundler.ts +53 -5
  19. package/core/build/flux-plugins-generator.ts +315 -0
  20. package/core/build/index.ts +11 -7
  21. package/core/build/live-components-generator.ts +231 -0
  22. package/core/build/optimizer.ts +2 -54
  23. package/core/cli/index.ts +31 -13
  24. package/core/config/env.ts +38 -94
  25. package/core/config/runtime-config.ts +61 -58
  26. package/core/config/schema.ts +1 -0
  27. package/core/framework/server.ts +55 -11
  28. package/core/plugins/built-in/index.ts +7 -17
  29. package/core/plugins/built-in/static/index.ts +24 -10
  30. package/core/plugins/built-in/swagger/index.ts +228 -228
  31. package/core/plugins/built-in/vite/index.ts +374 -358
  32. package/core/plugins/dependency-manager.ts +5 -5
  33. package/core/plugins/manager.ts +57 -14
  34. package/core/plugins/registry.ts +3 -3
  35. package/core/server/index.ts +0 -1
  36. package/core/server/live/ComponentRegistry.ts +34 -8
  37. package/core/server/live/LiveComponentPerformanceMonitor.ts +1 -1
  38. package/core/server/live/websocket-plugin.ts +434 -434
  39. package/core/server/middleware/README.md +488 -0
  40. package/core/server/middleware/elysia-helpers.ts +227 -0
  41. package/core/server/middleware/index.ts +25 -9
  42. package/core/server/plugins/static-files-plugin.ts +231 -231
  43. package/core/utils/config-schema.ts +484 -0
  44. package/core/utils/env.ts +306 -0
  45. package/core/utils/helpers.ts +9 -3
  46. package/core/utils/logger/colors.ts +114 -0
  47. package/core/utils/logger/config.ts +35 -0
  48. package/core/utils/logger/formatter.ts +82 -0
  49. package/core/utils/logger/group-logger.ts +101 -0
  50. package/core/utils/logger/index.ts +199 -250
  51. package/core/utils/logger/stack-trace.ts +92 -0
  52. package/core/utils/logger/startup-banner.ts +92 -0
  53. package/core/utils/logger/winston-logger.ts +152 -0
  54. package/core/utils/version.ts +5 -0
  55. package/create-fluxstack.ts +1 -0
  56. package/fluxstack.config.ts +6 -12
  57. package/package.json +117 -114
  58. package/plugins/crypto-auth/README.md +238 -0
  59. package/plugins/crypto-auth/client/CryptoAuthClient.ts +325 -0
  60. package/plugins/crypto-auth/client/components/AuthProvider.tsx +190 -0
  61. package/plugins/crypto-auth/client/components/LoginButton.tsx +155 -0
  62. package/plugins/crypto-auth/client/components/ProtectedRoute.tsx +109 -0
  63. package/plugins/crypto-auth/client/components/SessionInfo.tsx +242 -0
  64. package/plugins/crypto-auth/client/components/index.ts +15 -0
  65. package/plugins/crypto-auth/client/index.ts +12 -0
  66. package/plugins/crypto-auth/index.ts +230 -0
  67. package/plugins/crypto-auth/package.json +65 -0
  68. package/plugins/crypto-auth/plugin.json +29 -0
  69. package/plugins/crypto-auth/server/AuthMiddleware.ts +237 -0
  70. package/plugins/crypto-auth/server/CryptoAuthService.ts +293 -0
  71. package/plugins/crypto-auth/server/index.ts +9 -0
  72. package/vite.config.ts +16 -0
  73. package/core/config/env-dynamic.ts +0 -326
  74. package/core/plugins/built-in/logger/index.ts +0 -180
  75. package/core/server/plugins/logger.ts +0 -47
  76. package/core/utils/env-runtime-v2.ts +0 -232
  77. package/core/utils/env-runtime.ts +0 -259
  78. package/core/utils/logger/formatters.ts +0 -222
  79. package/core/utils/logger/middleware.ts +0 -253
  80. package/core/utils/logger/performance.ts +0 -384
  81. package/core/utils/logger/transports.ts +0 -365
  82. package/core/utils/logger.ts +0 -106
@@ -0,0 +1,231 @@
1
+ // 🚀 FluxStack Live Components - Auto Registration Generator
2
+ // Automatically generates component registration during build time
3
+
4
+ import { existsSync, readdirSync, writeFileSync, unlinkSync, readFileSync } from 'fs'
5
+ import { join, extname, basename } from 'path'
6
+
7
+ export interface ComponentInfo {
8
+ fileName: string
9
+ className: string
10
+ componentName: string
11
+ filePath: string
12
+ }
13
+
14
+ export class LiveComponentsGenerator {
15
+ private componentsPath: string
16
+ private registrationFilePath: string
17
+ private backupFilePath: string
18
+
19
+ constructor() {
20
+ this.componentsPath = join(process.cwd(), 'app', 'server', 'live')
21
+ this.registrationFilePath = join(process.cwd(), 'app', 'server', 'live', 'register-components.ts')
22
+ this.backupFilePath = join(process.cwd(), 'app', 'server', 'live', 'register-components.backup.ts')
23
+ }
24
+
25
+ /**
26
+ * Scan the live components directory and discover all components
27
+ */
28
+ discoverComponents(): ComponentInfo[] {
29
+ if (!existsSync(this.componentsPath)) {
30
+ console.log('⚠️ Live components directory not found:', this.componentsPath)
31
+ return []
32
+ }
33
+
34
+ const components: ComponentInfo[] = []
35
+ const files = readdirSync(this.componentsPath)
36
+
37
+ for (const file of files) {
38
+ // Skip non-TypeScript files, backup files, and the registration file itself
39
+ if (!file.endsWith('.ts') ||
40
+ file === 'register-components.ts' ||
41
+ file.includes('.backup.') ||
42
+ file.includes('.bak')) {
43
+ continue
44
+ }
45
+
46
+ const filePath = join(this.componentsPath, file)
47
+ const fileName = basename(file, extname(file))
48
+
49
+ try {
50
+ // Read file content to extract class name
51
+ const content = readFileSync(filePath, 'utf-8')
52
+
53
+ // Look for class exports that extend LiveComponent
54
+ const classMatches = content.match(/export\s+class\s+(\w+)\s+extends\s+LiveComponent/g)
55
+
56
+ if (classMatches && classMatches.length > 0) {
57
+ for (const match of classMatches) {
58
+ const classNameMatch = match.match(/class\s+(\w+)/)
59
+ if (classNameMatch) {
60
+ const className = classNameMatch[1]
61
+ const componentName = className.replace(/Component$/, '')
62
+
63
+ components.push({
64
+ fileName,
65
+ className,
66
+ componentName,
67
+ filePath: `./${fileName}`
68
+ })
69
+
70
+ console.log(`🔍 Discovered component: ${className} -> ${componentName}`)
71
+ }
72
+ }
73
+ }
74
+ } catch (error) {
75
+ console.warn(`⚠️ Failed to analyze ${file}:`, error)
76
+ }
77
+ }
78
+
79
+ return components
80
+ }
81
+
82
+ /**
83
+ * Generate the registration file with all discovered components
84
+ */
85
+ generateRegistrationFile(components: ComponentInfo[]): void {
86
+ // Backup existing file if it exists
87
+ if (existsSync(this.registrationFilePath)) {
88
+ const existingContent = readFileSync(this.registrationFilePath, 'utf-8')
89
+ writeFileSync(this.backupFilePath, existingContent)
90
+ console.log('📄 Backed up existing register-components.ts')
91
+ }
92
+
93
+ // Generate imports
94
+ const imports = components
95
+ .map(comp => `import { ${comp.className} } from "${comp.filePath}"`)
96
+ .join('\n')
97
+
98
+ // Generate registrations
99
+ const registrations = components
100
+ .map(comp => ` componentRegistry.registerComponentClass('${comp.componentName}', ${comp.className})`)
101
+ .join('\n')
102
+
103
+ // Generate file content
104
+ const fileContent = `// 🔥 Auto-generated Live Components Registration
105
+ // This file is automatically generated during build time - DO NOT EDIT MANUALLY
106
+ // Generated at: ${new Date().toISOString()}
107
+
108
+ ${imports}
109
+ import { componentRegistry } from "@/core/server/live/ComponentRegistry"
110
+
111
+ // Register all components statically for production bundle
112
+ function registerAllComponents() {
113
+ try {
114
+ // Auto-generated component registrations
115
+ ${registrations}
116
+
117
+ console.log('📝 Live components registered successfully! (${components.length} components)')
118
+ } catch (error) {
119
+ console.warn('⚠️ Error registering components:', error)
120
+ }
121
+ }
122
+
123
+ // Auto-register components
124
+ registerAllComponents()
125
+
126
+ // Export all components to ensure they're included in the bundle
127
+ export {
128
+ ${components.map(comp => ` ${comp.className}`).join(',\n')}
129
+ }
130
+ `
131
+
132
+ writeFileSync(this.registrationFilePath, fileContent)
133
+ console.log(`✅ Generated registration file with ${components.length} components`)
134
+ }
135
+
136
+ /**
137
+ * Restore the original registration file from backup
138
+ */
139
+ restoreOriginalFile(): void {
140
+ if (existsSync(this.backupFilePath)) {
141
+ const backupContent = readFileSync(this.backupFilePath, 'utf-8')
142
+ writeFileSync(this.registrationFilePath, backupContent)
143
+ unlinkSync(this.backupFilePath)
144
+ console.log('🔄 Restored original register-components.ts')
145
+ } else {
146
+ console.log('⚠️ No backup file found, keeping generated registration file')
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Check if the current registration file is auto-generated
152
+ */
153
+ isAutoGenerated(): boolean {
154
+ if (!existsSync(this.registrationFilePath)) {
155
+ return false
156
+ }
157
+
158
+ const content = readFileSync(this.registrationFilePath, 'utf-8')
159
+ return content.includes('// 🔥 Auto-generated Live Components Registration')
160
+ }
161
+
162
+ /**
163
+ * Pre-build hook: Generate registration file
164
+ */
165
+ async preBuild(): Promise<ComponentInfo[]> {
166
+ console.log('🚀 [PRE-BUILD] Generating Live Components registration...')
167
+
168
+ const components = this.discoverComponents()
169
+
170
+ if (components.length === 0) {
171
+ console.log('⚠️ No Live Components found to register')
172
+ return []
173
+ }
174
+
175
+ this.generateRegistrationFile(components)
176
+
177
+ return components
178
+ }
179
+
180
+ /**
181
+ * Post-build hook: Clean up generated file (optional)
182
+ */
183
+ async postBuild(keepGenerated: boolean = false): Promise<void> {
184
+ console.log('🧹 [POST-BUILD] Cleaning up Live Components registration...')
185
+
186
+ if (keepGenerated) {
187
+ console.log('📝 Keeping auto-generated registration file for production')
188
+ // Remove backup since we're keeping the generated version
189
+ if (existsSync(this.backupFilePath)) {
190
+ unlinkSync(this.backupFilePath)
191
+ }
192
+ } else {
193
+ this.restoreOriginalFile()
194
+ }
195
+ }
196
+
197
+ /**
198
+ * Development mode: Check if registration needs update
199
+ */
200
+ needsUpdate(): boolean {
201
+ if (!this.isAutoGenerated()) {
202
+ return false // Manual file, don't touch
203
+ }
204
+
205
+ const components = this.discoverComponents()
206
+ const currentContent = readFileSync(this.registrationFilePath, 'utf-8')
207
+
208
+ // Check if all discovered components are in the current file
209
+ for (const comp of components) {
210
+ if (!currentContent.includes(`'${comp.componentName}', ${comp.className}`)) {
211
+ return true
212
+ }
213
+ }
214
+
215
+ return false
216
+ }
217
+
218
+ /**
219
+ * Development mode: Update registration if needed
220
+ */
221
+ updateIfNeeded(): void {
222
+ if (this.needsUpdate()) {
223
+ console.log('🔄 Live Components changed, updating registration...')
224
+ const components = this.discoverComponents()
225
+ this.generateRegistrationFile(components)
226
+ }
227
+ }
228
+ }
229
+
230
+ // Export singleton instance
231
+ export const liveComponentsGenerator = new LiveComponentsGenerator()
@@ -4,7 +4,6 @@ import { gzipSync } from "zlib"
4
4
  import type { OptimizationConfig, OptimizationResult } from "../types/build"
5
5
 
6
6
  export interface OptimizerConfig {
7
- minify: boolean
8
7
  treeshake: boolean
9
8
  compress: boolean
10
9
  removeUnusedCSS: boolean
@@ -36,10 +35,7 @@ export class Optimizer {
36
35
  // Get original size
37
36
  results.originalSize = await this.calculateDirectorySize(buildPath)
38
37
 
39
- // Apply optimizations
40
- if (this.config.minify) {
41
- await this.minifyAssets(buildPath, results)
42
- }
38
+ // Apply optimizations (minification removed for compatibility)
43
39
 
44
40
  if (this.config.compress) {
45
41
  await this.compressAssets(buildPath, results)
@@ -80,55 +76,7 @@ export class Optimizer {
80
76
  }
81
77
  }
82
78
 
83
- private async minifyAssets(buildPath: string, results: OptimizationResult): Promise<void> {
84
- console.log("🗜️ Minifying assets...")
85
-
86
- const files = this.getFilesRecursively(buildPath)
87
- let minifiedCount = 0
88
-
89
- for (const file of files) {
90
- const ext = extname(file).toLowerCase()
91
-
92
- if (ext === '.js' || ext === '.css') {
93
- try {
94
- const content = readFileSync(file, 'utf-8')
95
- const minified = await this.minifyContent(content, ext)
96
-
97
- if (minified !== content) {
98
- writeFileSync(file, minified)
99
- minifiedCount++
100
- }
101
- } catch (error) {
102
- console.warn(`⚠️ Failed to minify ${file}:`, error)
103
- }
104
- }
105
- }
106
-
107
- results.optimizations.push({
108
- type: 'minification',
109
- description: `Minified ${minifiedCount} files`,
110
- sizeSaved: 0 // Would calculate actual size saved
111
- })
112
- }
113
-
114
- private async minifyContent(content: string, type: string): Promise<string> {
115
- // Basic minification - in a real implementation, you'd use proper minifiers
116
- if (type === '.js') {
117
- return content
118
- .replace(/\/\*[\s\S]*?\*\//g, '') // Remove comments
119
- .replace(/\/\/.*$/gm, '') // Remove single-line comments
120
- .replace(/\s+/g, ' ') // Collapse whitespace
121
- .trim()
122
- } else if (type === '.css') {
123
- return content
124
- .replace(/\/\*[\s\S]*?\*\//g, '') // Remove comments
125
- .replace(/\s+/g, ' ') // Collapse whitespace
126
- .replace(/;\s*}/g, '}') // Remove unnecessary semicolons
127
- .trim()
128
- }
129
-
130
- return content
131
- }
79
+ // Minification methods removed for compatibility with Bun bundler
132
80
 
133
81
  private async compressAssets(buildPath: string, results: OptimizationResult): Promise<void> {
134
82
  console.log("📦 Compressing assets...")
package/core/cli/index.ts CHANGED
@@ -6,6 +6,7 @@ import { getConfigSync } from "../config"
6
6
  import { cliRegistry } from "./command-registry"
7
7
  import { pluginDiscovery } from "./plugin-discovery"
8
8
  import { generateCommand, interactiveGenerateCommand } from "./generators/index.js"
9
+ import { startGroup, endGroup, logBox, logInGroup } from "../utils/logger/group-logger"
9
10
 
10
11
  const command = process.argv[2]
11
12
  const args = process.argv.slice(3)
@@ -134,12 +135,20 @@ Examples:
134
135
  }
135
136
  ],
136
137
  handler: async (args, options, context) => {
137
- console.log("⚡ FluxStack Full-Stack Development")
138
- console.log(`🌐 Frontend: http://localhost:${options['frontend-port']}`)
139
- console.log(`🚀 Backend: http://localhost:${options.port}`)
140
- console.log("🔄 Backend inicia Vite programaticamente - Zero órfãos!")
141
- console.log("📦 Starting backend server...")
142
- console.log()
138
+ // Grouped startup messages
139
+ startGroup({
140
+ title: 'FluxStack Development Server',
141
+ icon: '⚡',
142
+ color: 'cyan'
143
+ })
144
+
145
+ logInGroup(`Frontend: http://localhost:${options['frontend-port']}`, '🌐')
146
+ logInGroup(`Backend: http://localhost:${options.port}`, '🚀')
147
+ logInGroup('Backend inicia Vite programaticamente', '🔄')
148
+ logInGroup('Starting backend server...', '📦')
149
+
150
+ endGroup()
151
+ console.log('') // Separator line
143
152
 
144
153
  const { spawn } = await import("child_process")
145
154
  const devProcess = spawn("bun", ["--watch", "app/server/index.ts"], {
@@ -293,12 +302,20 @@ async function main() {
293
302
  async function handleLegacyCommands() {
294
303
  switch (command) {
295
304
  case "dev":
296
- console.log("⚡ FluxStack Full-Stack Development")
297
- console.log("🌐 Frontend: http://localhost:5173")
298
- console.log("🚀 Backend: http://localhost:3000")
299
- console.log("🔄 Backend inicia Vite programaticamente - Zero órfãos!")
300
- console.log("📦 Starting backend server...")
301
- console.log()
305
+ // Grouped startup messages
306
+ startGroup({
307
+ title: 'FluxStack Development Server',
308
+ icon: '⚡',
309
+ color: 'cyan'
310
+ })
311
+
312
+ logInGroup('Frontend: http://localhost:5173', '🌐')
313
+ logInGroup('Backend: http://localhost:3000', '🚀')
314
+ logInGroup('Backend inicia Vite programaticamente', '🔄')
315
+ logInGroup('Starting backend server...', '📦')
316
+
317
+ endGroup()
318
+ console.log('') // Separator line
302
319
 
303
320
  // Start only backend - it will start Vite programmatically
304
321
  const { spawn } = await import("child_process")
@@ -385,7 +402,8 @@ async function handleLegacyCommands() {
385
402
 
386
403
  case "start":
387
404
  console.log("🚀 Starting FluxStack production server...")
388
- await import(process.cwd() + "/dist/index.js")
405
+ const { join } = await import("path")
406
+ await import(join(process.cwd(), "dist", "index.js"))
389
407
  break
390
408
 
391
409
  case "create":
@@ -3,6 +3,7 @@
3
3
  * Handles environment variable processing and precedence
4
4
  */
5
5
 
6
+ import { env, helpers } from '../utils/env'
6
7
  import type { FluxStackConfig, LogLevel, BuildTarget, LogFormat } from './schema'
7
8
 
8
9
  export interface EnvironmentInfo {
@@ -24,7 +25,7 @@ export interface ConfigPrecedence {
24
25
  * Get current environment information
25
26
  */
26
27
  export function getEnvironmentInfo(): EnvironmentInfo {
27
- const nodeEnv = process.env.NODE_ENV || 'development'
28
+ const nodeEnv = env.NODE_ENV
28
29
 
29
30
  return {
30
31
  name: nodeEnv,
@@ -97,117 +98,60 @@ export class EnvironmentProcessor {
97
98
  const config: any = {}
98
99
 
99
100
  // App configuration
100
- this.setConfigValue(config, 'app.name',
101
- process.env.FLUXSTACK_APP_NAME || process.env.APP_NAME, 'string')
102
- this.setConfigValue(config, 'app.version',
103
- process.env.FLUXSTACK_APP_VERSION || process.env.APP_VERSION, 'string')
104
- this.setConfigValue(config, 'app.description',
105
- process.env.FLUXSTACK_APP_DESCRIPTION || process.env.APP_DESCRIPTION, 'string')
101
+ this.setConfigValue(config, 'app.name', env.FLUXSTACK_APP_NAME, 'string')
102
+ this.setConfigValue(config, 'app.version', env.FLUXSTACK_APP_VERSION, 'string')
106
103
 
107
104
  // Server configuration
108
- this.setConfigValue(config, 'server.port',
109
- process.env.PORT || process.env.FLUXSTACK_PORT, 'number')
110
- this.setConfigValue(config, 'server.host',
111
- process.env.HOST || process.env.FLUXSTACK_HOST, 'string')
112
- this.setConfigValue(config, 'server.apiPrefix',
113
- process.env.FLUXSTACK_API_PREFIX || process.env.API_PREFIX, 'string')
105
+ this.setConfigValue(config, 'server.port', env.PORT?.toString(), 'number')
106
+ this.setConfigValue(config, 'server.host', env.HOST, 'string')
107
+ this.setConfigValue(config, 'server.apiPrefix', env.API_PREFIX, 'string')
114
108
 
115
109
  // CORS configuration
116
- this.setConfigValue(config, 'server.cors.origins',
117
- process.env.CORS_ORIGINS || process.env.FLUXSTACK_CORS_ORIGINS, 'array')
118
- this.setConfigValue(config, 'server.cors.methods',
119
- process.env.CORS_METHODS || process.env.FLUXSTACK_CORS_METHODS, 'array')
120
- this.setConfigValue(config, 'server.cors.headers',
121
- process.env.CORS_HEADERS || process.env.FLUXSTACK_CORS_HEADERS, 'array')
122
- this.setConfigValue(config, 'server.cors.credentials',
123
- process.env.CORS_CREDENTIALS || process.env.FLUXSTACK_CORS_CREDENTIALS, 'boolean')
124
- this.setConfigValue(config, 'server.cors.maxAge',
125
- process.env.CORS_MAX_AGE || process.env.FLUXSTACK_CORS_MAX_AGE, 'number')
110
+ const corsOriginsStr = env.has('CORS_ORIGINS') ? env.all().CORS_ORIGINS : undefined
111
+ const corsMethodsStr = env.has('CORS_METHODS') ? env.all().CORS_METHODS : undefined
112
+ const corsHeadersStr = env.has('CORS_HEADERS') ? env.all().CORS_HEADERS : undefined
113
+
114
+ this.setConfigValue(config, 'server.cors.origins', corsOriginsStr, 'array')
115
+ this.setConfigValue(config, 'server.cors.methods', corsMethodsStr, 'array')
116
+ this.setConfigValue(config, 'server.cors.headers', corsHeadersStr, 'array')
117
+ this.setConfigValue(config, 'server.cors.credentials', env.CORS_CREDENTIALS?.toString(), 'boolean')
118
+ this.setConfigValue(config, 'server.cors.maxAge', env.CORS_MAX_AGE?.toString(), 'number')
126
119
 
127
120
  // Client configuration
128
- this.setConfigValue(config, 'client.port',
129
- process.env.VITE_PORT || process.env.CLIENT_PORT || process.env.FLUXSTACK_CLIENT_PORT, 'number')
130
- this.setConfigValue(config, 'client.proxy.target',
131
- process.env.VITE_API_URL || process.env.API_URL || process.env.FLUXSTACK_PROXY_TARGET, 'string')
132
- this.setConfigValue(config, 'client.build.sourceMaps',
133
- process.env.FLUXSTACK_CLIENT_SOURCEMAPS, 'boolean')
134
- this.setConfigValue(config, 'client.build.minify',
135
- process.env.FLUXSTACK_CLIENT_MINIFY, 'boolean')
121
+ this.setConfigValue(config, 'client.port', env.VITE_PORT?.toString(), 'number')
136
122
 
137
123
  // Build configuration
138
- this.setConfigValue(config, 'build.target',
139
- process.env.BUILD_TARGET || process.env.FLUXSTACK_BUILD_TARGET, 'buildTarget')
140
- this.setConfigValue(config, 'build.outDir',
141
- process.env.BUILD_OUTDIR || process.env.FLUXSTACK_BUILD_OUTDIR, 'string')
142
- this.setConfigValue(config, 'build.sourceMaps',
143
- process.env.BUILD_SOURCEMAPS || process.env.FLUXSTACK_BUILD_SOURCEMAPS, 'boolean')
144
- this.setConfigValue(config, 'build.clean',
145
- process.env.BUILD_CLEAN || process.env.FLUXSTACK_BUILD_CLEAN, 'boolean')
146
-
147
- // Build optimization
148
- this.setConfigValue(config, 'build.optimization.minify',
149
- process.env.BUILD_MINIFY || process.env.FLUXSTACK_BUILD_MINIFY, 'boolean')
150
- this.setConfigValue(config, 'build.optimization.treeshake',
151
- process.env.BUILD_TREESHAKE || process.env.FLUXSTACK_BUILD_TREESHAKE, 'boolean')
152
- this.setConfigValue(config, 'build.optimization.compress',
153
- process.env.BUILD_COMPRESS || process.env.FLUXSTACK_BUILD_COMPRESS, 'boolean')
154
- this.setConfigValue(config, 'build.optimization.splitChunks',
155
- process.env.BUILD_SPLIT_CHUNKS || process.env.FLUXSTACK_BUILD_SPLIT_CHUNKS, 'boolean')
156
- this.setConfigValue(config, 'build.optimization.bundleAnalyzer',
157
- process.env.BUILD_ANALYZER || process.env.FLUXSTACK_BUILD_ANALYZER, 'boolean')
124
+ const buildMinify = env.has('BUILD_MINIFY') ? env.all().BUILD_MINIFY : undefined
125
+ this.setConfigValue(config, 'build.optimization.minify', buildMinify, 'boolean')
158
126
 
159
127
  // Logging configuration
160
- this.setConfigValue(config, 'logging.level',
161
- process.env.LOG_LEVEL || process.env.FLUXSTACK_LOG_LEVEL, 'logLevel')
162
- this.setConfigValue(config, 'logging.format',
163
- process.env.LOG_FORMAT || process.env.FLUXSTACK_LOG_FORMAT, 'logFormat')
128
+ this.setConfigValue(config, 'logging.level', env.LOG_LEVEL, 'logLevel')
129
+ this.setConfigValue(config, 'logging.format', env.LOG_FORMAT, 'logFormat')
164
130
 
165
131
  // Monitoring configuration
166
- this.setConfigValue(config, 'monitoring.enabled',
167
- process.env.MONITORING_ENABLED || process.env.FLUXSTACK_MONITORING_ENABLED, 'boolean')
168
- this.setConfigValue(config, 'monitoring.metrics.enabled',
169
- process.env.METRICS_ENABLED || process.env.FLUXSTACK_METRICS_ENABLED, 'boolean')
170
- this.setConfigValue(config, 'monitoring.metrics.collectInterval',
171
- process.env.METRICS_INTERVAL || process.env.FLUXSTACK_METRICS_INTERVAL, 'number')
172
- this.setConfigValue(config, 'monitoring.profiling.enabled',
173
- process.env.PROFILING_ENABLED || process.env.FLUXSTACK_PROFILING_ENABLED, 'boolean')
174
- this.setConfigValue(config, 'monitoring.profiling.sampleRate',
175
- process.env.PROFILING_SAMPLE_RATE || process.env.FLUXSTACK_PROFILING_SAMPLE_RATE, 'number')
132
+ this.setConfigValue(config, 'monitoring.enabled', env.ENABLE_MONITORING?.toString(), 'boolean')
133
+ this.setConfigValue(config, 'monitoring.metrics.enabled', env.ENABLE_METRICS?.toString(), 'boolean')
176
134
 
177
135
  // Database configuration
178
- this.setConfigValue(config, 'database.url', process.env.DATABASE_URL, 'string')
179
- this.setConfigValue(config, 'database.host', process.env.DATABASE_HOST, 'string')
180
- this.setConfigValue(config, 'database.port', process.env.DATABASE_PORT, 'number')
181
- this.setConfigValue(config, 'database.database', process.env.DATABASE_NAME, 'string')
182
- this.setConfigValue(config, 'database.user', process.env.DATABASE_USER, 'string')
183
- this.setConfigValue(config, 'database.password', process.env.DATABASE_PASSWORD, 'string')
184
- this.setConfigValue(config, 'database.ssl', process.env.DATABASE_SSL, 'boolean')
185
- this.setConfigValue(config, 'database.poolSize', process.env.DATABASE_POOL_SIZE, 'number')
136
+ this.setConfigValue(config, 'database.url', env.DATABASE_URL, 'string')
137
+ this.setConfigValue(config, 'database.host', env.DB_HOST, 'string')
138
+ this.setConfigValue(config, 'database.port', env.DB_PORT?.toString(), 'number')
139
+ this.setConfigValue(config, 'database.database', env.DB_NAME, 'string')
140
+ this.setConfigValue(config, 'database.user', env.DB_USER, 'string')
141
+ this.setConfigValue(config, 'database.password', env.DB_PASSWORD, 'string')
142
+ this.setConfigValue(config, 'database.ssl', env.DB_SSL?.toString(), 'boolean')
186
143
 
187
144
  // Auth configuration
188
- this.setConfigValue(config, 'auth.secret', process.env.JWT_SECRET, 'string')
189
- this.setConfigValue(config, 'auth.expiresIn', process.env.JWT_EXPIRES_IN, 'string')
190
- this.setConfigValue(config, 'auth.algorithm', process.env.JWT_ALGORITHM, 'string')
191
- this.setConfigValue(config, 'auth.issuer', process.env.JWT_ISSUER, 'string')
145
+ this.setConfigValue(config, 'auth.secret', env.JWT_SECRET, 'string')
146
+ this.setConfigValue(config, 'auth.expiresIn', env.JWT_EXPIRES_IN, 'string')
147
+ this.setConfigValue(config, 'auth.algorithm', env.JWT_ALGORITHM, 'string')
192
148
 
193
149
  // Email configuration
194
- this.setConfigValue(config, 'email.host', process.env.SMTP_HOST, 'string')
195
- this.setConfigValue(config, 'email.port', process.env.SMTP_PORT, 'number')
196
- this.setConfigValue(config, 'email.user', process.env.SMTP_USER, 'string')
197
- this.setConfigValue(config, 'email.password', process.env.SMTP_PASSWORD, 'string')
198
- this.setConfigValue(config, 'email.secure', process.env.SMTP_SECURE, 'boolean')
199
- this.setConfigValue(config, 'email.from', process.env.SMTP_FROM, 'string')
200
-
201
- // Storage configuration
202
- this.setConfigValue(config, 'storage.uploadPath', process.env.UPLOAD_PATH, 'string')
203
- this.setConfigValue(config, 'storage.maxFileSize', process.env.MAX_FILE_SIZE, 'number')
204
- this.setConfigValue(config, 'storage.provider', process.env.STORAGE_PROVIDER, 'string')
205
-
206
- // Plugin configuration
207
- this.setConfigValue(config, 'plugins.enabled',
208
- process.env.FLUXSTACK_PLUGINS_ENABLED, 'array')
209
- this.setConfigValue(config, 'plugins.disabled',
210
- process.env.FLUXSTACK_PLUGINS_DISABLED, 'array')
150
+ this.setConfigValue(config, 'email.host', env.SMTP_HOST, 'string')
151
+ this.setConfigValue(config, 'email.port', env.SMTP_PORT?.toString(), 'number')
152
+ this.setConfigValue(config, 'email.user', env.SMTP_USER, 'string')
153
+ this.setConfigValue(config, 'email.password', env.SMTP_PASSWORD, 'string')
154
+ this.setConfigValue(config, 'email.secure', env.SMTP_SECURE?.toString(), 'boolean')
211
155
 
212
156
  return this.cleanEmptyObjects(config)
213
157
  }