@corva/create-app 0.43.0-0 → 0.43.0-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/bin/create-corva-app.cjs +1 -1
- package/common/node/.env +15 -0
- package/common/node/.env.sample +26 -0
- package/common/python/.env +14 -0
- package/common/python/.env.sample +23 -0
- package/lib/constants/package.js +1 -1
- package/lib/helpers/utils.js +19 -1
- package/lib/main.js +4 -0
- package/package.json +1 -1
package/bin/create-corva-app.cjs
CHANGED
package/common/node/.env
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
API_KEY=
|
|
2
|
+
APP_KEY=${APP_KEY}
|
|
3
|
+
APP_NAME=${APP_NAME}
|
|
4
|
+
PROVIDER=${PROVIDER}
|
|
5
|
+
|
|
6
|
+
API_ROOT_URL=https://api.corva.ai
|
|
7
|
+
DATA_API_ROOT_URL=https://data.corva.ai
|
|
8
|
+
CACHE_URL=redis://localhost:6379
|
|
9
|
+
|
|
10
|
+
LOG_LEVEL=debug
|
|
11
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
12
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
13
|
+
|
|
14
|
+
ENVIRONMENT=development
|
|
15
|
+
NODE_ENV=development
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Corva API key to perform actions with the API
|
|
2
|
+
API_KEY=
|
|
3
|
+
# Unique ID of the app
|
|
4
|
+
APP_KEY=
|
|
5
|
+
# Human readable name of the app
|
|
6
|
+
APP_NAME=
|
|
7
|
+
# Company identifier
|
|
8
|
+
PROVIDER=
|
|
9
|
+
|
|
10
|
+
# Root URL for Corva API
|
|
11
|
+
API_ROOT_URL=
|
|
12
|
+
# Root URL for Corva Data API
|
|
13
|
+
DATA_API_ROOT_URL=
|
|
14
|
+
# Redis cache url for caching data in Stream/Scheduler apps
|
|
15
|
+
CACHE_URL=
|
|
16
|
+
|
|
17
|
+
# Logging configuration, see https://corva-ai.github.io/node-sdk/docs/v7.2.0/classes/CorvaLogger
|
|
18
|
+
LOG_LEVEL=debug
|
|
19
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
20
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
21
|
+
|
|
22
|
+
# Working environment
|
|
23
|
+
ENVIRONMENT=development
|
|
24
|
+
|
|
25
|
+
# nodejs-specific settings
|
|
26
|
+
NODE_ENV=development
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
API_KEY=
|
|
2
|
+
APP_KEY=${APP_KEY}
|
|
3
|
+
APP_NAME=${APP_NAME}
|
|
4
|
+
PROVIDER=${PROVIDER}
|
|
5
|
+
|
|
6
|
+
API_ROOT_URL=https://api.corva.ai
|
|
7
|
+
DATA_API_ROOT_URL=https://data.corva.ai
|
|
8
|
+
CACHE_URL=redis://localhost:6379
|
|
9
|
+
|
|
10
|
+
LOG_LEVEL=DEBUG
|
|
11
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
12
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
13
|
+
|
|
14
|
+
ENVIRONMENT=development
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Corva API key to perform actions with the API
|
|
2
|
+
API_KEY=
|
|
3
|
+
# Unique ID of the app
|
|
4
|
+
APP_KEY=
|
|
5
|
+
# Human readable name of the app
|
|
6
|
+
APP_NAME=
|
|
7
|
+
# Company short identifier
|
|
8
|
+
PROVIDER=
|
|
9
|
+
|
|
10
|
+
# Root URL for Corva API
|
|
11
|
+
API_ROOT_URL=
|
|
12
|
+
# Root URL for Corva Data API
|
|
13
|
+
DATA_API_ROOT_URL=
|
|
14
|
+
# Redis cache url for caching data in Stream/Scheduler apps
|
|
15
|
+
CACHE_URL=
|
|
16
|
+
|
|
17
|
+
# Logging configuration, see https://corva-ai.github.io/python-sdk/corva-sdk/1.7.0/index.html#_logging
|
|
18
|
+
LOG_LEVEL=DEBUG
|
|
19
|
+
LOG_THRESHOLD_MESSAGE_SIZE=99999
|
|
20
|
+
LOG_THRESHOLD_MESSAGE_COUNT=99999
|
|
21
|
+
|
|
22
|
+
# Working environment
|
|
23
|
+
ENVIRONMENT=development
|
package/lib/constants/package.js
CHANGED
package/lib/helpers/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
1
|
+
import path, { join } from 'node:path';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
|
|
4
4
|
export function copyFileSync(source, target) {
|
|
@@ -38,3 +38,21 @@ export function copyFolderRecursiveSync(sourceFolder, targetFolder) {
|
|
|
38
38
|
copyFileSync(curSource, targetFolder);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param {string} root
|
|
45
|
+
* @param {import('../flows/lib/manifest').Manifest} manifest
|
|
46
|
+
*/
|
|
47
|
+
export const putVariablesInEnvFile = async (root, manifest) => {
|
|
48
|
+
const pathToEnvFile = join(root, '.env');
|
|
49
|
+
const envFileContent = await fs.readFile(pathToEnvFile, 'utf8');
|
|
50
|
+
|
|
51
|
+
await fs.writeFile(
|
|
52
|
+
pathToEnvFile,
|
|
53
|
+
envFileContent
|
|
54
|
+
.replace(new RegExp('\\${APP_KEY}', 'g'), manifest.manifest.application.key)
|
|
55
|
+
.replace(new RegExp('\\${PROVIDER}', 'g'), manifest.manifest.application.key.split('.')[0])
|
|
56
|
+
.replace(new RegExp('\\${APP_NAME}', 'g'), manifest.manifest.application.name)
|
|
57
|
+
);
|
|
58
|
+
};
|
package/lib/main.js
CHANGED
|
@@ -377,6 +377,10 @@ async function addTemplate(root, manifest, runtime) {
|
|
|
377
377
|
utils.copyFolderRecursiveSync(path.resolve(__dirname, '..', 'common', 'python'), root);
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
if (!manifest.isUi()) {
|
|
381
|
+
await utils.putVariablesInEnvFile(root, manifest);
|
|
382
|
+
}
|
|
383
|
+
|
|
380
384
|
// We can't have .gitignore file in our templates.
|
|
381
385
|
// It's missing when @corva/create-app is installed.
|
|
382
386
|
// That's why we manually rename gitignore to .gitignore after copying template
|