saleor-apps-redis_apl/apps/search/saleor-app.ts
Lukasz Ostrowski 7240f6efa7 Add docker, prisma and worker POC
Add docker-compose with Postgres

Install Prisma and generate empty schema

Install Prisma client

Add app config model and migration

Add repository for Algolia Configuration

Migrate metadata to postgres

Replace webhooks metadata with PRisma

Add worker and skeleton code

Implement worker job and removed from the frontend

Attempt to display jobs list

Worker utils

Run worker in the same thread on dev

Run worker in the same thread on dev

Build scripts

fix dev mode

Dockerfiles

prod dockerfiles

docker wip

docker wip

wip working docker

wip working docker

wip - working without prisma migrate
2023-06-07 11:07:37 +02:00

42 lines
1.1 KiB
TypeScript

import { APL, FileAPL, UpstashAPL, SaleorCloudAPL } from "@saleor/app-sdk/APL";
import { SaleorApp } from "@saleor/app-sdk/saleor-app";
/**
* By default auth data are stored in the `.auth-data.json` (FileAPL).
* For multi-tenant applications and deployments please use UpstashAPL.
*
* To read more about storing auth data, read the
* [APL documentation](https://github.com/saleor/saleor-app-sdk/blob/main/docs/apl.md)
*/
const aplType = process.env.APL ?? "file";
let apl: APL;
switch (aplType) {
case "upstash":
apl = new UpstashAPL();
break;
case "file":
apl = new FileAPL();
break;
case "saleor-cloud": {
if (!process.env.REST_APL_ENDPOINT || !process.env.REST_APL_TOKEN) {
throw new Error("Rest APL is not configured - missing env variables. Check saleor-app.ts");
}
apl = new SaleorCloudAPL({
resourceUrl: process.env.REST_APL_ENDPOINT as string,
token: process.env.REST_APL_TOKEN as string,
});
break;
}
default: {
throw new Error("Invalid APL config");
}
}
export const saleorApp = new SaleorApp({
apl,
});