create-fluxstack 1.5.0 → 1.5.1
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.
- package/.env.example +1 -8
- package/app/client/src/App.tsx +1 -4
- package/app/server/index.ts +0 -4
- package/app/server/routes/index.ts +1 -5
- package/config/index.ts +1 -9
- package/core/cli/generators/plugin.ts +34 -324
- package/core/cli/generators/template-engine.ts +0 -5
- package/core/cli/plugin-discovery.ts +12 -33
- package/core/framework/server.ts +0 -10
- package/core/plugins/dependency-manager.ts +22 -89
- package/core/plugins/index.ts +0 -4
- package/core/plugins/manager.ts +2 -3
- package/core/plugins/registry.ts +1 -28
- package/core/utils/logger/index.ts +0 -4
- package/fluxstack.config.ts +114 -253
- package/package.json +117 -117
- package/CRYPTO-AUTH-MIDDLEWARE-GUIDE.md +0 -475
- package/CRYPTO-AUTH-MIDDLEWARES.md +0 -473
- package/CRYPTO-AUTH-USAGE.md +0 -491
- package/EXEMPLO-ROTA-PROTEGIDA.md +0 -347
- package/QUICK-START-CRYPTO-AUTH.md +0 -221
- package/app/client/src/pages/CryptoAuthPage.tsx +0 -394
- package/app/server/routes/crypto-auth-demo.routes.ts +0 -167
- package/app/server/routes/example-with-crypto-auth.routes.ts +0 -235
- package/app/server/routes/exemplo-posts.routes.ts +0 -161
- package/core/plugins/module-resolver.ts +0 -216
- package/plugins/crypto-auth/README.md +0 -788
- package/plugins/crypto-auth/ai-context.md +0 -1282
- package/plugins/crypto-auth/cli/make-protected-route.command.ts +0 -383
- package/plugins/crypto-auth/client/CryptoAuthClient.ts +0 -302
- package/plugins/crypto-auth/client/components/AuthProvider.tsx +0 -131
- package/plugins/crypto-auth/client/components/LoginButton.tsx +0 -138
- package/plugins/crypto-auth/client/components/ProtectedRoute.tsx +0 -89
- package/plugins/crypto-auth/client/components/index.ts +0 -12
- package/plugins/crypto-auth/client/index.ts +0 -12
- package/plugins/crypto-auth/config/index.ts +0 -34
- package/plugins/crypto-auth/index.ts +0 -162
- package/plugins/crypto-auth/package.json +0 -66
- package/plugins/crypto-auth/server/AuthMiddleware.ts +0 -181
- package/plugins/crypto-auth/server/CryptoAuthService.ts +0 -186
- package/plugins/crypto-auth/server/index.ts +0 -22
- package/plugins/crypto-auth/server/middlewares/cryptoAuthAdmin.ts +0 -65
- package/plugins/crypto-auth/server/middlewares/cryptoAuthOptional.ts +0 -26
- package/plugins/crypto-auth/server/middlewares/cryptoAuthPermissions.ts +0 -76
- package/plugins/crypto-auth/server/middlewares/cryptoAuthRequired.ts +0 -45
- package/plugins/crypto-auth/server/middlewares/helpers.ts +0 -140
- package/plugins/crypto-auth/server/middlewares/index.ts +0 -22
- package/plugins/crypto-auth/server/middlewares.ts +0 -19
- package/test-crypto-auth.ts +0 -101
package/fluxstack.config.ts
CHANGED
|
@@ -1,261 +1,74 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* FluxStack Configuration
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Enhanced configuration with comprehensive settings and environment support
|
|
4
|
+
* Uses unified environment loader
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { FluxStackConfig } from './core/config/schema'
|
|
8
|
-
import { defineConfig, config as configHelpers } from './core/utils/config-schema'
|
|
9
8
|
import { env, helpers } from './core/utils/env'
|
|
10
9
|
|
|
11
10
|
console.log(`🔧 Loading FluxStack config for ${env.NODE_ENV} environment`)
|
|
12
11
|
|
|
13
|
-
//
|
|
14
|
-
// 📋 DECLARATIVE CONFIG SCHEMAS
|
|
15
|
-
// ============================================================================
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Application Configuration Schema
|
|
19
|
-
*/
|
|
20
|
-
const appConfigSchema = {
|
|
21
|
-
name: configHelpers.string('FLUXSTACK_APP_NAME', 'FluxStack', true),
|
|
22
|
-
version: configHelpers.string('FLUXSTACK_APP_VERSION', '1.0.0', true),
|
|
23
|
-
description: configHelpers.string('FLUXSTACK_APP_DESCRIPTION', 'A FluxStack application')
|
|
24
|
-
} as const
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* CORS Configuration Schema
|
|
28
|
-
*/
|
|
29
|
-
const corsConfigSchema = {
|
|
30
|
-
origins: configHelpers.array('CORS_ORIGINS', ['http://localhost:3000', 'http://localhost:5173']),
|
|
31
|
-
methods: configHelpers.array('CORS_METHODS', ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']),
|
|
32
|
-
headers: configHelpers.array('CORS_HEADERS', ['Content-Type', 'Authorization']),
|
|
33
|
-
credentials: configHelpers.boolean('CORS_CREDENTIALS', false),
|
|
34
|
-
maxAge: configHelpers.number('CORS_MAX_AGE', 86400)
|
|
35
|
-
} as const
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Server Configuration Schema
|
|
39
|
-
*/
|
|
40
|
-
const serverConfigSchema = {
|
|
41
|
-
port: configHelpers.number('PORT', 3000, true),
|
|
42
|
-
host: configHelpers.string('HOST', 'localhost', true),
|
|
43
|
-
apiPrefix: configHelpers.string('API_PREFIX', '/api', true)
|
|
44
|
-
} as const
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Client Proxy Configuration Schema
|
|
48
|
-
*/
|
|
49
|
-
const clientProxyConfigSchema = {
|
|
50
|
-
target: {
|
|
51
|
-
type: 'string' as const,
|
|
52
|
-
env: 'PROXY_TARGET',
|
|
53
|
-
default: helpers.getServerUrl(),
|
|
54
|
-
required: false
|
|
55
|
-
},
|
|
56
|
-
changeOrigin: configHelpers.boolean('PROXY_CHANGE_ORIGIN', true)
|
|
57
|
-
} as const
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Client Build Configuration Schema
|
|
61
|
-
*/
|
|
62
|
-
const clientBuildConfigSchema = {
|
|
63
|
-
sourceMaps: configHelpers.boolean('CLIENT_SOURCEMAPS', helpers.isDevelopment()),
|
|
64
|
-
minify: configHelpers.boolean('CLIENT_MINIFY', helpers.isProduction()),
|
|
65
|
-
target: configHelpers.string('CLIENT_TARGET', 'esnext'),
|
|
66
|
-
outDir: configHelpers.string('CLIENT_OUTDIR', 'dist/client')
|
|
67
|
-
} as const
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Client Configuration Schema
|
|
71
|
-
*/
|
|
72
|
-
const clientConfigSchema = {
|
|
73
|
-
port: configHelpers.number('VITE_PORT', 5173, true)
|
|
74
|
-
} as const
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Build Optimization Configuration Schema
|
|
78
|
-
*/
|
|
79
|
-
const buildOptimizationConfigSchema = {
|
|
80
|
-
minify: configHelpers.boolean('BUILD_MINIFY', helpers.isProduction()),
|
|
81
|
-
treeshake: configHelpers.boolean('BUILD_TREESHAKE', helpers.isProduction()),
|
|
82
|
-
compress: configHelpers.boolean('BUILD_COMPRESS', helpers.isProduction()),
|
|
83
|
-
splitChunks: configHelpers.boolean('BUILD_SPLIT_CHUNKS', true),
|
|
84
|
-
bundleAnalyzer: configHelpers.boolean('BUILD_ANALYZER', helpers.isDevelopment())
|
|
85
|
-
} as const
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Build Configuration Schema
|
|
89
|
-
*/
|
|
90
|
-
const buildConfigSchema = {
|
|
91
|
-
target: configHelpers.enum('BUILD_TARGET', ['bun', 'node', 'docker'] as const, 'bun'),
|
|
92
|
-
outDir: configHelpers.string('BUILD_OUTDIR', 'dist'),
|
|
93
|
-
sourceMaps: configHelpers.boolean('BUILD_SOURCEMAPS', !helpers.isProduction()),
|
|
94
|
-
minify: configHelpers.boolean('BUILD_MINIFY', helpers.isProduction()),
|
|
95
|
-
treeshake: configHelpers.boolean('BUILD_TREESHAKE', helpers.isProduction()),
|
|
96
|
-
clean: configHelpers.boolean('BUILD_CLEAN', true)
|
|
97
|
-
} as const
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Plugins Configuration Schema
|
|
101
|
-
*/
|
|
102
|
-
const pluginsConfigSchema = {
|
|
103
|
-
enabled: configHelpers.array('FLUXSTACK_PLUGINS_ENABLED', ['logger', 'swagger', 'vite', 'cors', 'static-files', 'crypto-auth']),
|
|
104
|
-
disabled: configHelpers.array('FLUXSTACK_PLUGINS_DISABLED', [])
|
|
105
|
-
} as const
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Logging Configuration Schema
|
|
109
|
-
*/
|
|
110
|
-
const loggingConfigSchema = {
|
|
111
|
-
level: configHelpers.enum('LOG_LEVEL', ['debug', 'info', 'warn', 'error'] as const, helpers.isDevelopment() ? 'debug' : 'info'),
|
|
112
|
-
format: configHelpers.enum('LOG_FORMAT', ['json', 'pretty'] as const, helpers.isDevelopment() ? 'pretty' : 'json')
|
|
113
|
-
} as const
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Monitoring Metrics Configuration Schema
|
|
117
|
-
*/
|
|
118
|
-
const monitoringMetricsConfigSchema = {
|
|
119
|
-
enabled: configHelpers.boolean('ENABLE_METRICS', false),
|
|
120
|
-
collectInterval: configHelpers.number('METRICS_INTERVAL', 5000),
|
|
121
|
-
httpMetrics: configHelpers.boolean('HTTP_METRICS', true),
|
|
122
|
-
systemMetrics: configHelpers.boolean('SYSTEM_METRICS', true),
|
|
123
|
-
customMetrics: configHelpers.boolean('CUSTOM_METRICS', false)
|
|
124
|
-
} as const
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Monitoring Profiling Configuration Schema
|
|
128
|
-
*/
|
|
129
|
-
const monitoringProfilingConfigSchema = {
|
|
130
|
-
enabled: configHelpers.boolean('PROFILING_ENABLED', false),
|
|
131
|
-
sampleRate: configHelpers.number('PROFILING_SAMPLE_RATE', 0.1),
|
|
132
|
-
memoryProfiling: configHelpers.boolean('MEMORY_PROFILING', false),
|
|
133
|
-
cpuProfiling: configHelpers.boolean('CPU_PROFILING', false)
|
|
134
|
-
} as const
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Monitoring Configuration Schema
|
|
138
|
-
*/
|
|
139
|
-
const monitoringConfigSchema = {
|
|
140
|
-
enabled: configHelpers.boolean('ENABLE_MONITORING', false),
|
|
141
|
-
exporters: configHelpers.array('MONITORING_EXPORTERS', [])
|
|
142
|
-
} as const
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Database Configuration Schema (Optional)
|
|
146
|
-
*/
|
|
147
|
-
const databaseConfigSchema = {
|
|
148
|
-
url: configHelpers.string('DATABASE_URL', ''),
|
|
149
|
-
host: configHelpers.string('DB_HOST', ''),
|
|
150
|
-
port: configHelpers.number('DB_PORT', 5432),
|
|
151
|
-
database: configHelpers.string('DB_NAME', ''),
|
|
152
|
-
user: configHelpers.string('DB_USER', ''),
|
|
153
|
-
password: configHelpers.string('DB_PASSWORD', ''),
|
|
154
|
-
ssl: configHelpers.boolean('DB_SSL', false),
|
|
155
|
-
poolSize: configHelpers.number('DB_POOL_SIZE', 10)
|
|
156
|
-
} as const
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Auth Configuration Schema (Optional)
|
|
160
|
-
*/
|
|
161
|
-
const authConfigSchema = {
|
|
162
|
-
secret: configHelpers.string('JWT_SECRET', ''),
|
|
163
|
-
expiresIn: configHelpers.string('JWT_EXPIRES_IN', '24h'),
|
|
164
|
-
algorithm: configHelpers.string('JWT_ALGORITHM', 'HS256'),
|
|
165
|
-
issuer: configHelpers.string('JWT_ISSUER', '')
|
|
166
|
-
} as const
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Email Configuration Schema (Optional)
|
|
170
|
-
*/
|
|
171
|
-
const emailConfigSchema = {
|
|
172
|
-
host: configHelpers.string('SMTP_HOST', ''),
|
|
173
|
-
port: configHelpers.number('SMTP_PORT', 587),
|
|
174
|
-
user: configHelpers.string('SMTP_USER', ''),
|
|
175
|
-
password: configHelpers.string('SMTP_PASSWORD', ''),
|
|
176
|
-
secure: configHelpers.boolean('SMTP_SECURE', false),
|
|
177
|
-
from: configHelpers.string('SMTP_FROM', '')
|
|
178
|
-
} as const
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Storage Configuration Schema (Optional)
|
|
182
|
-
*/
|
|
183
|
-
const storageConfigSchema = {
|
|
184
|
-
uploadPath: configHelpers.string('UPLOAD_PATH', ''),
|
|
185
|
-
maxFileSize: configHelpers.number('MAX_FILE_SIZE', 10485760), // 10MB
|
|
186
|
-
allowedTypes: configHelpers.array('ALLOWED_FILE_TYPES', []),
|
|
187
|
-
provider: configHelpers.enum('STORAGE_PROVIDER', ['local', 's3', 'gcs'] as const, 'local')
|
|
188
|
-
} as const
|
|
189
|
-
|
|
190
|
-
// ============================================================================
|
|
191
|
-
// ⚡ LOAD CONFIGURATIONS USING DECLARATIVE SYSTEM
|
|
192
|
-
// ============================================================================
|
|
193
|
-
|
|
194
|
-
const appConfig = defineConfig(appConfigSchema)
|
|
195
|
-
const corsConfig = defineConfig(corsConfigSchema)
|
|
196
|
-
const serverConfig = defineConfig(serverConfigSchema)
|
|
197
|
-
const clientProxyConfig = defineConfig(clientProxyConfigSchema)
|
|
198
|
-
const clientBuildConfig = defineConfig(clientBuildConfigSchema)
|
|
199
|
-
const clientConfig = defineConfig(clientConfigSchema)
|
|
200
|
-
const buildOptimizationConfig = defineConfig(buildOptimizationConfigSchema)
|
|
201
|
-
const buildConfig = defineConfig(buildConfigSchema)
|
|
202
|
-
const pluginsConfig = defineConfig(pluginsConfigSchema)
|
|
203
|
-
const loggingConfig = defineConfig(loggingConfigSchema)
|
|
204
|
-
const monitoringMetricsConfig = defineConfig(monitoringMetricsConfigSchema)
|
|
205
|
-
const monitoringProfilingConfig = defineConfig(monitoringProfilingConfigSchema)
|
|
206
|
-
const monitoringConfig = defineConfig(monitoringConfigSchema)
|
|
207
|
-
|
|
208
|
-
// Optional configs (only load if env vars are present)
|
|
209
|
-
const databaseConfig = (env.has('DATABASE_URL') || env.has('DATABASE_HOST'))
|
|
210
|
-
? defineConfig(databaseConfigSchema)
|
|
211
|
-
: undefined
|
|
212
|
-
|
|
213
|
-
const authConfig = env.has('JWT_SECRET')
|
|
214
|
-
? defineConfig(authConfigSchema)
|
|
215
|
-
: undefined
|
|
216
|
-
|
|
217
|
-
const emailConfig = env.has('SMTP_HOST')
|
|
218
|
-
? defineConfig(emailConfigSchema)
|
|
219
|
-
: undefined
|
|
220
|
-
|
|
221
|
-
const storageConfig = (env.has('UPLOAD_PATH') || env.has('STORAGE_PROVIDER'))
|
|
222
|
-
? defineConfig(storageConfigSchema)
|
|
223
|
-
: undefined
|
|
224
|
-
|
|
225
|
-
// ============================================================================
|
|
226
|
-
// 🚀 MAIN FLUXSTACK CONFIGURATION
|
|
227
|
-
// ============================================================================
|
|
228
|
-
|
|
12
|
+
// Main FluxStack configuration with dynamic env vars
|
|
229
13
|
export const config: FluxStackConfig = {
|
|
230
14
|
// Application metadata
|
|
231
|
-
app:
|
|
15
|
+
app: {
|
|
16
|
+
name: env.FLUXSTACK_APP_NAME, // Direto! (string)
|
|
17
|
+
version: env.FLUXSTACK_APP_VERSION, // Direto! (string)
|
|
18
|
+
description: env.get('FLUXSTACK_APP_DESCRIPTION', 'A FluxStack application')
|
|
19
|
+
},
|
|
232
20
|
|
|
233
21
|
// Server configuration
|
|
234
22
|
server: {
|
|
235
|
-
|
|
236
|
-
|
|
23
|
+
port: env.PORT, // Direto! (number)
|
|
24
|
+
host: env.HOST, // Direto! (string)
|
|
25
|
+
apiPrefix: env.API_PREFIX, // Direto! (string)
|
|
26
|
+
cors: {
|
|
27
|
+
origins: env.CORS_ORIGINS, // Direto! (string[])
|
|
28
|
+
methods: env.get('CORS_METHODS', ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']),
|
|
29
|
+
headers: env.get('CORS_HEADERS', ['Content-Type', 'Authorization']),
|
|
30
|
+
credentials: env.get('CORS_CREDENTIALS', false), // boolean casting
|
|
31
|
+
maxAge: env.get('CORS_MAX_AGE', 86400) // number casting
|
|
32
|
+
},
|
|
237
33
|
middleware: []
|
|
238
34
|
},
|
|
239
35
|
|
|
240
36
|
// Client configuration
|
|
241
37
|
client: {
|
|
242
|
-
|
|
243
|
-
proxy:
|
|
244
|
-
|
|
38
|
+
port: env.VITE_PORT, // Direto! (number)
|
|
39
|
+
proxy: {
|
|
40
|
+
target: helpers.getServerUrl(), // Helper inteligente
|
|
41
|
+
changeOrigin: env.get('PROXY_CHANGE_ORIGIN', true)
|
|
42
|
+
},
|
|
43
|
+
build: {
|
|
44
|
+
sourceMaps: env.get('CLIENT_SOURCEMAPS', helpers.isDevelopment()),
|
|
45
|
+
target: env.get('CLIENT_TARGET', 'esnext'),
|
|
46
|
+
outDir: env.get('CLIENT_OUTDIR', 'dist/client')
|
|
47
|
+
}
|
|
245
48
|
},
|
|
246
49
|
|
|
247
50
|
// Build configuration
|
|
248
51
|
build: {
|
|
249
|
-
|
|
250
|
-
|
|
52
|
+
target: env.get('BUILD_TARGET', 'bun'), // string casting
|
|
53
|
+
outDir: env.get('BUILD_OUTDIR', 'dist'), // string
|
|
54
|
+
optimization: {
|
|
55
|
+
treeshake: env.get('BUILD_TREESHAKE', helpers.isProduction()),
|
|
56
|
+
compress: env.get('BUILD_COMPRESS', helpers.isProduction()),
|
|
57
|
+
splitChunks: env.get('BUILD_SPLIT_CHUNKS', true),
|
|
58
|
+
bundleAnalyzer: env.get('BUILD_ANALYZER', helpers.isDevelopment())
|
|
59
|
+
},
|
|
60
|
+
sourceMaps: env.get('BUILD_SOURCEMAPS', !helpers.isProduction()),
|
|
61
|
+
clean: env.get('BUILD_CLEAN', true)
|
|
251
62
|
},
|
|
252
63
|
|
|
253
64
|
// Plugin configuration
|
|
254
65
|
plugins: {
|
|
255
|
-
|
|
66
|
+
enabled: env.get('FLUXSTACK_PLUGINS_ENABLED', ['logger', 'swagger', 'vite', 'cors', 'static-files', 'crypto-auth']),
|
|
67
|
+
disabled: env.get('FLUXSTACK_PLUGINS_DISABLED', []),
|
|
256
68
|
config: {
|
|
69
|
+
// Plugin-specific configurations can be added here
|
|
257
70
|
logger: {
|
|
258
|
-
// Logger plugin config handled by logging section
|
|
71
|
+
// Logger plugin config will be handled by logging section
|
|
259
72
|
},
|
|
260
73
|
swagger: {
|
|
261
74
|
title: env.get('SWAGGER_TITLE', 'FluxStack API'),
|
|
@@ -268,39 +81,95 @@ export const config: FluxStackConfig = {
|
|
|
268
81
|
cacheMaxAge: env.get('STATIC_CACHE_MAX_AGE', 31536000), // 1 year
|
|
269
82
|
enableUploads: env.get('STATIC_ENABLE_UPLOADS', true),
|
|
270
83
|
enablePublic: env.get('STATIC_ENABLE_PUBLIC', true)
|
|
84
|
+
},
|
|
85
|
+
'crypto-auth': {
|
|
86
|
+
enabled: env.get('CRYPTO_AUTH_ENABLED', true),
|
|
87
|
+
sessionTimeout: env.get('CRYPTO_AUTH_SESSION_TIMEOUT', 1800000), // 30 minutos
|
|
88
|
+
maxTimeDrift: env.get('CRYPTO_AUTH_MAX_TIME_DRIFT', 300000), // 5 minutos
|
|
89
|
+
adminKeys: env.get('CRYPTO_AUTH_ADMIN_KEYS', []),
|
|
90
|
+
protectedRoutes: env.get('CRYPTO_AUTH_PROTECTED_ROUTES', ['/api/admin/*', '/api/protected/*']),
|
|
91
|
+
publicRoutes: env.get('CRYPTO_AUTH_PUBLIC_ROUTES', ['/api/auth/*', '/api/health', '/api/docs']),
|
|
92
|
+
enableMetrics: env.get('CRYPTO_AUTH_ENABLE_METRICS', true)
|
|
271
93
|
}
|
|
272
|
-
// ✅ crypto-auth manages its own configuration
|
|
273
|
-
// See: plugins/crypto-auth/config/index.ts
|
|
274
94
|
}
|
|
275
95
|
},
|
|
276
96
|
|
|
277
97
|
// Logging configuration
|
|
278
98
|
logging: {
|
|
279
|
-
|
|
99
|
+
level: env.LOG_LEVEL as any, // Direto! (com smart default)
|
|
100
|
+
format: env.get('LOG_FORMAT', helpers.isDevelopment() ? 'pretty' : 'json'),
|
|
280
101
|
transports: [
|
|
281
102
|
{
|
|
282
103
|
type: 'console' as const,
|
|
283
|
-
level:
|
|
284
|
-
format:
|
|
104
|
+
level: env.LOG_LEVEL as any, // Direto! (com smart default)
|
|
105
|
+
format: env.get('LOG_FORMAT', helpers.isDevelopment() ? 'pretty' : 'json')
|
|
285
106
|
}
|
|
286
107
|
]
|
|
287
108
|
},
|
|
288
109
|
|
|
289
110
|
// Monitoring configuration
|
|
290
111
|
monitoring: {
|
|
291
|
-
|
|
292
|
-
metrics:
|
|
293
|
-
|
|
112
|
+
enabled: env.ENABLE_MONITORING, // Direto! (boolean)
|
|
113
|
+
metrics: {
|
|
114
|
+
enabled: env.ENABLE_METRICS, // Direto! (boolean)
|
|
115
|
+
collectInterval: env.get('METRICS_INTERVAL', 5000), // number casting
|
|
116
|
+
httpMetrics: env.get('HTTP_METRICS', true),
|
|
117
|
+
systemMetrics: env.get('SYSTEM_METRICS', true),
|
|
118
|
+
customMetrics: env.get('CUSTOM_METRICS', false)
|
|
119
|
+
},
|
|
120
|
+
profiling: {
|
|
121
|
+
enabled: env.get('PROFILING_ENABLED', false),
|
|
122
|
+
sampleRate: env.get('PROFILING_SAMPLE_RATE', 0.1), // number casting
|
|
123
|
+
memoryProfiling: env.get('MEMORY_PROFILING', false),
|
|
124
|
+
cpuProfiling: env.get('CPU_PROFILING', false)
|
|
125
|
+
},
|
|
126
|
+
exporters: env.get('MONITORING_EXPORTERS', []) // array casting
|
|
294
127
|
},
|
|
295
128
|
|
|
296
|
-
// Optional
|
|
297
|
-
...(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
129
|
+
// Optional database configuration
|
|
130
|
+
...(env.has('DATABASE_URL') || env.has('DATABASE_HOST') ? {
|
|
131
|
+
database: {
|
|
132
|
+
url: env.DATABASE_URL, // Direto! (string)
|
|
133
|
+
host: env.DB_HOST, // Direto! (string)
|
|
134
|
+
port: env.DB_PORT, // Direto! (number)
|
|
135
|
+
database: env.DB_NAME, // Direto! (string)
|
|
136
|
+
user: env.DB_USER, // Direto! (string)
|
|
137
|
+
password: env.DB_PASSWORD, // Direto! (string)
|
|
138
|
+
ssl: env.DB_SSL, // Direto! (boolean)
|
|
139
|
+
poolSize: env.get('DB_POOL_SIZE', 10) // number casting
|
|
140
|
+
}
|
|
141
|
+
} : {}),
|
|
142
|
+
|
|
143
|
+
// Optional authentication configuration
|
|
144
|
+
...(env.has('JWT_SECRET') ? {
|
|
145
|
+
auth: {
|
|
146
|
+
secret: env.JWT_SECRET, // Direto! (string)
|
|
147
|
+
expiresIn: env.get('JWT_EXPIRES_IN', '24h'),
|
|
148
|
+
algorithm: env.get('JWT_ALGORITHM', 'HS256'),
|
|
149
|
+
issuer: env.get('JWT_ISSUER')
|
|
150
|
+
}
|
|
151
|
+
} : {}),
|
|
152
|
+
|
|
153
|
+
// Optional email configuration
|
|
154
|
+
...(env.has('SMTP_HOST') ? {
|
|
155
|
+
email: {
|
|
156
|
+
host: env.SMTP_HOST, // Direto! (string)
|
|
157
|
+
port: env.SMTP_PORT, // Direto! (number)
|
|
158
|
+
user: env.SMTP_USER, // Direto! (string)
|
|
159
|
+
password: env.SMTP_PASSWORD, // Direto! (string)
|
|
160
|
+
secure: env.SMTP_SECURE, // Direto! (boolean)
|
|
161
|
+
from: env.get('SMTP_FROM')
|
|
162
|
+
}
|
|
163
|
+
} : {}),
|
|
164
|
+
|
|
165
|
+
// Optional storage configuration
|
|
166
|
+
...(env.has('UPLOAD_PATH') || env.has('STORAGE_PROVIDER') ? {
|
|
301
167
|
storage: {
|
|
302
|
-
|
|
303
|
-
|
|
168
|
+
uploadPath: env.get('UPLOAD_PATH'),
|
|
169
|
+
maxFileSize: env.get('MAX_FILE_SIZE', 10485760), // 10MB default
|
|
170
|
+
allowedTypes: env.get('ALLOWED_FILE_TYPES', []), // array casting
|
|
171
|
+
provider: env.get('STORAGE_PROVIDER', 'local'),
|
|
172
|
+
config: env.get('STORAGE_CONFIG', {}) // object casting
|
|
304
173
|
}
|
|
305
174
|
} : {}),
|
|
306
175
|
|
|
@@ -323,7 +192,6 @@ export const config: FluxStackConfig = {
|
|
|
323
192
|
proxy: { target: 'http://localhost:3000' },
|
|
324
193
|
build: {
|
|
325
194
|
sourceMaps: true,
|
|
326
|
-
minify: false,
|
|
327
195
|
target: 'es2020',
|
|
328
196
|
outDir: 'dist'
|
|
329
197
|
}
|
|
@@ -332,15 +200,12 @@ export const config: FluxStackConfig = {
|
|
|
332
200
|
target: 'bun',
|
|
333
201
|
outDir: 'dist',
|
|
334
202
|
optimization: {
|
|
335
|
-
minify: false,
|
|
336
203
|
compress: false,
|
|
337
204
|
treeshake: false,
|
|
338
205
|
splitChunks: false,
|
|
339
206
|
bundleAnalyzer: false
|
|
340
207
|
},
|
|
341
208
|
sourceMaps: true,
|
|
342
|
-
minify: false,
|
|
343
|
-
treeshake: false,
|
|
344
209
|
clean: true
|
|
345
210
|
},
|
|
346
211
|
monitoring: {
|
|
@@ -378,7 +243,6 @@ export const config: FluxStackConfig = {
|
|
|
378
243
|
proxy: { target: 'http://localhost:3000' },
|
|
379
244
|
build: {
|
|
380
245
|
sourceMaps: false,
|
|
381
|
-
minify: true,
|
|
382
246
|
target: 'es2020',
|
|
383
247
|
outDir: 'dist'
|
|
384
248
|
}
|
|
@@ -387,15 +251,12 @@ export const config: FluxStackConfig = {
|
|
|
387
251
|
target: 'bun',
|
|
388
252
|
outDir: 'dist',
|
|
389
253
|
optimization: {
|
|
390
|
-
minify: true,
|
|
391
254
|
treeshake: false,
|
|
392
255
|
compress: false,
|
|
393
256
|
splitChunks: false,
|
|
394
257
|
bundleAnalyzer: false
|
|
395
258
|
},
|
|
396
259
|
sourceMaps: false,
|
|
397
|
-
minify: true,
|
|
398
|
-
treeshake: false,
|
|
399
260
|
clean: true
|
|
400
261
|
},
|
|
401
262
|
monitoring: {
|
|
@@ -439,7 +300,7 @@ export const config: FluxStackConfig = {
|
|
|
439
300
|
client: {
|
|
440
301
|
port: 0, // Use random available port
|
|
441
302
|
proxy: { target: 'http://localhost:3000' },
|
|
442
|
-
build: { sourceMaps: true,
|
|
303
|
+
build: { sourceMaps: true, target: 'es2020', outDir: 'dist' }
|
|
443
304
|
},
|
|
444
305
|
monitoring: {
|
|
445
306
|
enabled: false,
|