fix: pipeline

This commit is contained in:
2023-05-31 15:30:25 +02:00
parent 68400f2480
commit 45444d9373
31 changed files with 74 additions and 120 deletions

View File

@@ -15,24 +15,29 @@
import {Logger} from '@openstapps/logger';
import {Command} from 'commander';
import {readFileSync} from 'fs';
import {join} from 'path';
import path from 'path';
import {executeConnector, isValidSCNamespace} from './common.js';
import {MinimalConnector} from './minimal-connector.js';
import * as url from 'url';
process.on('unhandledRejection', error => {
throw error;
});
const connectorVersion = JSON.parse(readFileSync(join(__dirname, '..', 'package.json')).toString()).version;
const dirname = path.dirname(url.fileURLToPath(import.meta.url));
const connectorVersion = JSON.parse(
readFileSync(path.join(dirname, '..', 'package.json')).toString(),
).version;
const commander = new Command();
/**
* Uses arguments to paramtrize the connector execution
* Uses arguments to parameterize the connector execution
*
* backendURL - URL of the StApps backend deployment e.g. http://localhost:3000
* origin - Origin, where the data comes from. Typically the name of the connector e.g. minimal-connector
* licensePlate - The license plate of your school. Must be matched to a SCNamespace e.g. f-u
* origin - Origin, where the data comes from.
* Typically, the name of the connector e.g., minimal-connector licensePlate - The license plate of your school.
* Must be matched to a SCNamespace e.g., f-u
*/
commander
.command('run <backendURL> <origin> <licensePlate>')
@@ -41,7 +46,7 @@ commander
if (backendURL.length === 0) {
throw new Error('Param "backend" needs to have a length greater zero.');
}
const originRegex = /^[a-z\-\_0-9]+$/;
const originRegex = /^[a-z\-_0-9]+$/;
if (!originRegex.test(origin)) {
throw new Error(
'Origin name can only consist of lowercase letters from a-z, "-", "_" and integer numbers.',