go-duck-cli 1.3.37 → 1.3.351
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/generators/config.js +1 -6
- package/generators/postman.js +1 -1
- package/generators/swagger.js +1 -1
- package/index.js +1 -9
- package/package.json +1 -1
package/generators/config.js
CHANGED
|
@@ -2,11 +2,6 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
|
|
5
|
-
const toKebabCase = (str) => {
|
|
6
|
-
if (!str) return '';
|
|
7
|
-
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
8
|
-
};
|
|
9
|
-
|
|
10
5
|
export const generateConfigLoader = async (outputDir, configObj) => {
|
|
11
6
|
const configDir = path.join(outputDir, 'config');
|
|
12
7
|
await fs.ensureDir(configDir);
|
|
@@ -248,7 +243,7 @@ func LoadConfig() (*Config, error) {
|
|
|
248
243
|
// Default values
|
|
249
244
|
v.SetDefault("go-duck.server.rest.port", 8080)
|
|
250
245
|
v.SetDefault("go-duck.server.rest.protocol", "json")
|
|
251
|
-
v.SetDefault("go-duck.server.rest.api-path-prefix", "/${
|
|
246
|
+
v.SetDefault("go-duck.server.rest.api-path-prefix", "/${configObj.name || 'api'}/api")
|
|
252
247
|
v.SetDefault("go-duck.security.rate-limit.rps", 100.0)
|
|
253
248
|
v.SetDefault("go-duck.security.rate-limit.burst", 200)
|
|
254
249
|
v.SetDefault("go-duck.logging.datadog.enabled", false)
|
package/generators/postman.js
CHANGED
|
@@ -18,7 +18,7 @@ export const generatePostmanCollection = async (config, entities, outputDir, ope
|
|
|
18
18
|
item: [],
|
|
19
19
|
variable: [
|
|
20
20
|
{ key: "host", value: "localhost", type: "string" },
|
|
21
|
-
{ key: "port", value: String(config.server?.
|
|
21
|
+
{ key: "port", value: String(config.server?.port || 8080), type: "string" },
|
|
22
22
|
{ key: "tenant", value: "tenant_1", type: "string" },
|
|
23
23
|
{ key: "token", value: "", type: "string" },
|
|
24
24
|
{ key: "keycloak_url", value: config.security?.['keycloak-host'] || "http://localhost:8180", type: "string" },
|
package/generators/swagger.js
CHANGED
|
@@ -17,7 +17,7 @@ export const generateSwaggerDocs = async (config, entities, outputDir, openEntit
|
|
|
17
17
|
description: `Generated documentation for ${config.name} microservice`
|
|
18
18
|
},
|
|
19
19
|
servers: [
|
|
20
|
-
{ url: `http://localhost:${config.server?.
|
|
20
|
+
{ url: `http://localhost:${config.server?.port || 8080}`, description: 'Local Development Server' }
|
|
21
21
|
],
|
|
22
22
|
paths: {},
|
|
23
23
|
components: {
|
package/index.js
CHANGED
|
@@ -875,21 +875,13 @@ const generateYAMLConfigs = async (config, outputDir) => {
|
|
|
875
875
|
delete cleanConfig.datasource['multitenancy-databases'];
|
|
876
876
|
}
|
|
877
877
|
|
|
878
|
-
const toKebabCase = (str) => {
|
|
879
|
-
if (!str) return '';
|
|
880
|
-
return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
const rawApiPrefix = cleanConfig.server?.rest?.['api-path-prefix'] || `/${cleanConfig.name || 'api'}/api`;
|
|
884
|
-
const kebabApiPrefix = rawApiPrefix.split('/').map(segment => toKebabCase(segment)).join('/');
|
|
885
|
-
|
|
886
878
|
const extendedConfig = {
|
|
887
879
|
...cleanConfig,
|
|
888
880
|
server: {
|
|
889
881
|
rest: {
|
|
890
882
|
port: cleanConfig.server?.rest?.port || cleanConfig.server?.port || 8080,
|
|
891
883
|
protocol: cleanConfig.server?.rest?.protocol || 'json',
|
|
892
|
-
'api-path-prefix':
|
|
884
|
+
'api-path-prefix': cleanConfig.server?.rest?.['api-path-prefix'] || `/${cleanConfig.name || 'api'}/api`
|
|
893
885
|
},
|
|
894
886
|
'read-timeout': cleanConfig.server?.['read-timeout'] || '30s',
|
|
895
887
|
'write-timeout': cleanConfig.server?.['write-timeout'] || '30s',
|