Skip to content

Commit 4db5fb6

Browse files
committed
add settings
1 parent ef0549c commit 4db5fb6

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/api/addContextMiddle.ts

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const logger:Logger = {
2626

2727
export const addContextMiddle = function (req:Request, res:Response, next:NextFunction) {
2828
var dd = new Date()
29+
//logger.info("addContextMiddle","test log")
2930
if(req.url.startsWith("/api-docs")){
3031
return next();
3132
}

src/app.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
import * as dotenv from 'dotenv'
33
import express from "express";
44
import path from "path";
5-
import cookieParser from "cookie-parser";
6-
import logger from "morgan";
75
import { initialize } from "express-openapi";
86
import swaggerUi from "swagger-ui-express";
97
import ApiDocs from "./api/api-doc.json"
108
import bodyParser from "body-parser";
119
import cors from "cors";
1210
import {addContextMiddle} from "./api/addContextMiddle"
1311
import { createProxyMiddleware } from 'http-proxy-middleware'
14-
import TerminusClient , {WOQLClient,WOQL, AccessControl} from "@terminusdb/terminusdb-client"
12+
import { AccessControl} from "@terminusdb/terminusdb-client"
13+
import * as settings from './api/core/settings'
1514
declare namespace Express {
1615
export interface Request {
1716
context?: object
@@ -69,13 +68,9 @@ app.use(addContextMiddle)
6968
app.listen(3035,function(){
7069
// when we start the server we check if the terminusCR team already exists
7170
// if it does not exists we'll create it
72-
const endpoint :string = process.env.SERVER_ENDPOINT || "http://127.0.0.1:6363"
73-
const key = process.env.USER_KEY || "root"
74-
const CROrg = process.env.CR_TEAM_NAME || "terminusCR"
75-
const user = process.env.USER_NAME || "admin"
76-
const accessControl = new AccessControl(endpoint, { key: key, user: user })
71+
const accessControl = new AccessControl(settings.endpoint, { key: settings.key, user: settings.user })
7772

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

0 commit comments

Comments
 (0)