Skip to content

Commit

Permalink
add settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesca-Bit committed Jul 17, 2023
1 parent ef0549c commit 4db5fb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/api/addContextMiddle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const logger:Logger = {

export const addContextMiddle = function (req:Request, res:Response, next:NextFunction) {
var dd = new Date()
//logger.info("addContextMiddle","test log")
if(req.url.startsWith("/api-docs")){
return next();
}
Expand Down
13 changes: 4 additions & 9 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
import * as dotenv from 'dotenv'
import express from "express";
import path from "path";
import cookieParser from "cookie-parser";
import logger from "morgan";
import { initialize } from "express-openapi";
import swaggerUi from "swagger-ui-express";
import ApiDocs from "./api/api-doc.json"
import bodyParser from "body-parser";
import cors from "cors";
import {addContextMiddle} from "./api/addContextMiddle"
import { createProxyMiddleware } from 'http-proxy-middleware'
import TerminusClient , {WOQLClient,WOQL, AccessControl} from "@terminusdb/terminusdb-client"
import { AccessControl} from "@terminusdb/terminusdb-client"
import * as settings from './api/core/settings'
declare namespace Express {
export interface Request {
context?: object
Expand Down Expand Up @@ -69,13 +68,9 @@ app.use(addContextMiddle)
app.listen(3035,function(){
// when we start the server we check if the terminusCR team already exists
// if it does not exists we'll create it
const endpoint :string = process.env.SERVER_ENDPOINT || "http://127.0.0.1:6363"
const key = process.env.USER_KEY || "root"
const CROrg = process.env.CR_TEAM_NAME || "terminusCR"
const user = process.env.USER_NAME || "admin"
const accessControl = new AccessControl(endpoint, { key: key, user: user })
const accessControl = new AccessControl(settings.endpoint, { key: settings.key, user: settings.user })

accessControl.createOrganization(CROrg).then(result=>{
accessControl.createOrganization(settings.CROrg).then(result=>{
console.log("The Change Request team has been created")
}).catch((err:any)=>{
if (typeof err.data === 'object' && err.data['api:error']
Expand Down

0 comments on commit 4db5fb6

Please sign in to comment.