-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2346237
commit 44a3e38
Showing
26 changed files
with
484 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
variables: | ||
DOCKER_IMAGE_NAME: dockerhub.fokus.fraunhofer.de:5000/learning-technologies/clm-framework/clm-ext-tool | ||
DOCKER_TLS_CERTDIR: "/certs" | ||
|
||
stages: | ||
- build_push | ||
|
||
default: | ||
image: docker:24.0.5 | ||
tags: | ||
- build_docker | ||
services: | ||
- docker:24.0.5-dind | ||
before_script: | ||
- docker info | ||
|
||
build_push_image: | ||
stage: build_push | ||
image: docker:latest | ||
tags: | ||
- build_docker | ||
services: | ||
- docker:dind | ||
script: | ||
- echo "Building Docker image..." | ||
- docker login dockerhub.fokus.fraunhofer.de:5000 -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" | ||
- docker build -t $DOCKER_IMAGE_NAME:latest . | ||
- echo "Pushing Docker image..." | ||
- docker login dockerhub.fokus.fraunhofer.de:5000 -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" | ||
- > | ||
if docker pull $DOCKER_IMAGE_NAME:latest; then | ||
IMAGE_TAG=$CI_COMMIT_SHORT_SHA | ||
else | ||
IMAGE_TAG="latest" | ||
fi | ||
- docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_IMAGE_NAME:$IMAGE_TAG | ||
- docker push $DOCKER_IMAGE_NAME:$IMAGE_TAG | ||
only: | ||
- dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,53 @@ | ||
FROM node:20.5.1-alpine | ||
FROM node:20.18.1-alpine3.19 as builder | ||
|
||
# Install git and other necessary tools | ||
RUN apk add --no-cache git | ||
|
||
COPY . /app | ||
# Set the working directory | ||
WORKDIR /tmp | ||
|
||
# Copy only the necessary files temporarily for installation | ||
COPY package.json package-lock.json ./ | ||
|
||
# Install dependencies in a temporary directory | ||
RUN npm install | ||
|
||
# Stage 2: Final image | ||
FROM node:20.18.1-alpine3.19 | ||
|
||
# delete CVE | ||
RUN rm -r /usr/local/lib/node_modules/npm/node_modules/cross-spawn/ | ||
|
||
# Create a non-root user | ||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
RUN npm i | ||
# Install TypeScript globally | ||
RUN npm install -g typescript | ||
RUN tsc | ||
|
||
# Change ownership of the app directory | ||
RUN chown -R appuser:appgroup /app | ||
|
||
# Switch to the non-root user | ||
USER appuser | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Copy the rest of the application files | ||
COPY tsconfig.json healthcheck.js /app/ | ||
|
||
COPY ./src /app/src | ||
|
||
COPY server.ts /app/server.ts | ||
|
||
# Copy node_modules from the builder stage | ||
COPY --from=builder /tmp/node_modules ./node_modules | ||
|
||
# Compile TypeScript | ||
RUN rm -rf ./dist && npx tsc | ||
|
||
# Start the application | ||
CMD ["node", "./dist/server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
"use strict"; | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -28,10 +27,12 @@ | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
console.log(process.env.MARIA_CONFIG); | ||
const dotenv_1 = __importDefault(require("dotenv")); | ||
dotenv_1.default.config(); | ||
const clm_core_1 = require("clm-core"); | ||
|
@@ -60,6 +61,6 @@ Promise.all([ | |
clm_core_1.pathBDTOInstance.registerRoutes(app, ECLUDED_PATHS), | ||
]).then(() => { | ||
app.listen(PORT, () => { | ||
console.log(`Tools server is running on port ${PORT}`); | ||
console.log("listening for too‘ls"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -32,6 +27,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const express_1 = __importDefault(require("express")); | ||
const MgtmToolController_1 = __importDefault(require("./MgtmToolController")); | ||
const entryPointRouter = express_1.default.Router(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -41,6 +27,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const clm_core_1 = require("clm-core"); | ||
const clm_ext_learning_objects_1 = require("clm-ext-learning_objects"); | ||
const ToolDAO_1 = __importDefault(require("../models/Tool/ToolDAO")); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,3 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ToolType = exports.AuthType = exports.ToolModel = exports.ToolBDTO = exports.toolBDTOInstance = void 0; | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -53,6 +27,32 @@ exports.ToolType = exports.AuthType = exports.ToolModel = exports.ToolBDTO = exp | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ToolType = exports.AuthType = exports.ToolModel = exports.ToolBDTO = exports.toolBDTOInstance = void 0; | ||
const ToolBDTO_1 = require("../models/Tool/ToolBDTO"); | ||
Object.defineProperty(exports, "ToolBDTO", { enumerable: true, get: function () { return ToolBDTO_1.ToolBDTO; } }); | ||
Object.defineProperty(exports, "toolBDTOInstance", { enumerable: true, get: function () { return ToolBDTO_1.toolBDTOInstance; } }); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
"use strict"; | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -28,12 +27,14 @@ | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toolBDTOInstance = exports.ToolBDTO = void 0; | ||
const clm_core_1 = require("clm-core"); | ||
const ToolModel_1 = require("./ToolModel"); | ||
const ToolDAO_1 = __importDefault(require("./ToolDAO")); | ||
/** | ||
* Extends {@link https://gitlab.fokus.fraunhofer.de/learning-technologies/clm-framework/clm-core/-/blob/dev/docs/clm-core.basebackenddto.md|BaseBackendDTO} | ||
|
@@ -42,6 +43,12 @@ const ToolDAO_1 = __importDefault(require("./ToolDAO")); | |
* @public | ||
*/ | ||
class ToolBDTO extends clm_core_1.BaseBackendDTO { | ||
createMetadataTool(payload, serviceProviderId) { | ||
return ToolDAO_1.default.insert(Object.assign(Object.assign({}, payload), { type: ToolModel_1.ToolType.METADATA }), { serviceProviderId }); | ||
} | ||
deleteById(toolId) { | ||
return ToolDAO_1.default.deleteById(toolId); | ||
} | ||
} | ||
exports.ToolBDTO = ToolBDTO; | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
"use strict"; | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -28,6 +27,7 @@ | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* ----------------------------------------------------------------------------- | ||
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V. | ||
* | ||
|
@@ -29,6 +27,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); | |
* [email protected] | ||
* ----------------------------------------------------------------------------- | ||
*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const clm_core_1 = require("clm-core"); | ||
class CouchToolFDTO extends clm_core_1.BaseFrontendDTO { | ||
constructor(payload) { | ||
|
@@ -50,6 +50,14 @@ class CouchToolFDTO extends clm_core_1.BaseFrontendDTO { | |
this.authType = payload.authType; | ||
this.storageAccess = payload.storageAccess; | ||
this.key_set_url = payload.key_set_url; | ||
// lti 1.3 parameters | ||
this.jwks_url = payload.jwks_url; | ||
this.redirect_uris = payload.redirect_uris; | ||
this.oidc_login_url = payload.oidc_login_url; | ||
this.deployment_id = payload.deployment_id; | ||
this.target_link_uri = payload.target_link_uri || payload.launchableUrl; | ||
this.key_set_url = payload.key_set_url; | ||
this.client_id = payload.client_id; | ||
} | ||
} | ||
exports.default = CouchToolFDTO; |
Oops, something went wrong.