add env vars

This commit is contained in:
Simon Larsen
2023-02-21 17:58:55 +00:00
parent 90ba1b5f0a
commit 1f543fa69d
7 changed files with 34 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ export default class Text {
tempWord = this.replaceAt(tempWord.length - 1, tempWord, ' ');
}
return tempWord.toLowerCase();
return tempWord.toLowerCase().trim();
}
public static replaceAt(

View File

@@ -22,6 +22,7 @@ DATA_INGESTOR_HOSTNAME={{ .Env.DATA_INGESTOR_HOSTNAME }}
ACCOUNTS_HOSTNAME={{ .Env.ACCOUNTS_HOSTNAME }}
HOME_HOSTNAME={{ .Env.HOME_HOSTNAME }}
WORKER_HOSTNAME={{ .Env.WORKER_HOSTNAME }}
WORKFLOW_HOSTNAME={{ .Env.WORKFLOW_HOSTNAME }}
BILLING_PRIVATE_KEY={{ .Env.BILLING_PRIVATE_KEY }}
BILLING_PUBLIC_KEY={{ .Env.BILLING_PUBLIC_KEY }}
@@ -42,6 +43,7 @@ HELMCHARTS_ROUTE={{ .Env.HELMCHARTS_ROUTE }}
APIDOCS_ROUTE={{ .Env.APIDOCS_ROUTE }}
IDENTITY_ROUTE={{ .Env.IDENTITY_ROUTE }}
FILE_ROUTE={{ .Env.FILE_ROUTE }}
WORKFLOW_ROUTE={{ .Env.WORKFLOW_ROUTE }}
STATUS_PAGE_ROUTE={{ .Env.STATUS_PAGE_ROUTE }}
IS_SERVER=true

View File

@@ -23,7 +23,7 @@ import PostgresDatabase, {
import { DataSource, Repository, SelectQueryBuilder } from 'typeorm';
import ObjectID from 'Common/Types/ObjectID';
import SortOrder from 'Common/Types/Database/SortOrder';
import { EncryptionSecret, WorkflowHostname } from '../Config';
import { EncryptionSecret, WorkflowHostname, WorkflowRoute } from '../Config';
import HashedString from 'Common/Types/HashedString';
import UpdateByID from '../Types/Database/UpdateByID';
import Columns from 'Common/Types/Database/Columns';
@@ -485,7 +485,7 @@ class DatabaseService<TBaseModel extends BaseModel> {
new URL(
Protocol.HTTP,
WorkflowHostname,
new Route(`/model/${projectId.toString()}/${triggerType}`)
new Route(`${WorkflowRoute.toString()}/model/${projectId.toString()}/${triggerType}`)
),
{
data: JSONFunctions.toJSON(model, this.entityType),
@@ -564,7 +564,7 @@ class DatabaseService<TBaseModel extends BaseModel> {
// hit workflow.;
if (
this.getModel().enableWorkflowOn.create &&
this.getModel().enableWorkflowOn?.create &&
createBy.props.tenantId
) {
await this.onTrigger(
@@ -799,7 +799,7 @@ class DatabaseService<TBaseModel extends BaseModel> {
// hit workflow.
if (
this.getModel().enableWorkflowOn.delete &&
this.getModel().enableWorkflowOn?.delete &&
deleteBy.props.tenantId
) {
for (const item of items) {
@@ -1055,7 +1055,7 @@ class DatabaseService<TBaseModel extends BaseModel> {
// hit workflow.
if (
this.getModel().enableWorkflowOn.update &&
this.getModel().enableWorkflowOn?.update &&
updateBy.props.tenantId
) {
await this.onTrigger(

View File

@@ -27,7 +27,7 @@ export default class FindManyBaseModel<
i.id ===
`${Text.pascalCaseToDashes(
modelService.getModel().tableName!
)}-fine-many`
)}-find-many`
);
}
);

View File

@@ -25,7 +25,7 @@ export default class FindOneBaseModel<
i.id ===
`${Text.pascalCaseToDashes(
modelService.getModel().tableName!
)}-fine-one`
)}-find-one`
);
}
);

View File

@@ -19,20 +19,28 @@ import ClusterKeyAuthorization from '../../../Middleware/ClusterKeyAuthorization
export default class OnTriggerBaseModel<
TBaseModel extends BaseModel
> extends ComponentCode {
public modelId: string = "";
public type: string= "";
public constructor(
modelService: DatabaseService<TBaseModel>,
type: string
) {
super();
this.modelId = `${Text.pascalCaseToDashes(
modelService.getModel().tableName!
)}`;
this.type = type;
const BaseModelComponent: ComponentMetadata | undefined =
BaseModelComponents.getComponents(modelService.getModel()).find(
(i: ComponentMetadata) => {
return (
i.id ===
`${Text.pascalCaseToDashes(
modelService.getModel().tableName!
)}-${type}`
`${this.modelId}-${this.type}`
);
}
);
@@ -45,19 +53,29 @@ export default class OnTriggerBaseModel<
);
}
this.setMetadata(BaseModelComponent);
}
public override async init(props: InitProps): Promise<void> {
props.router.get(
`/model/:projectId/${this.getMetadata().id}`,
`/model/:projectId/${this.modelId}/${this.type}`,
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
async (req: ExpressRequest, res: ExpressResponse) => {
await this.initTrigger(req, res, props);
}
);
console.log(`/model-type/hello/${this.modelId}/${this.type}`);
props.router.get(
`/workflow/model-type/hello/${this.modelId}/${this.type}`,
async (req: ExpressRequest, res: ExpressResponse) => {
Response.sendJsonObjectResponse(req, res, {"hey": "here"});
}
);
props.router.post(
`/model/:projectId/${this.getMetadata().id}`,
`/model/:projectId/${this.modelId}/${this.type}`,
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
async (req: ExpressRequest, res: ExpressResponse) => {
await this.initTrigger(req, res, props);

View File

@@ -55,7 +55,7 @@ const init: Function = async (): Promise<void> => {
PostgresAppInstance.getDatasourceOptions()
);
app.use(`/${APP_NAME}/`, new ComponentCode().router);
app.use(`/`, new ComponentCode().router);
// connect redis
await Redis.connect();