refactor: make app portable for open source

- Remove hardcoded api.manoonoils.com fetch patch
- Make allowedSaleorUrls configurable via ALLOWED_SALEOR_URLS env var
- Make email logo/company configurable via EMAIL_LOGO_URL, EMAIL_COMPANY_NAME
- Add comprehensive README with deployment docs
- Keep internal networking preference via SALEOR_API_URL env var
This commit is contained in:
Unchained
2026-03-27 06:23:54 +02:00
parent debb1365b5
commit 7b52ab585a
3 changed files with 150 additions and 120 deletions
+5 -15
View File
@@ -1,21 +1,11 @@
// Patch fetch to force HTTPS for api.manoonoils.com
const originalFetch = global.fetch;
global.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {
let url = input.toString();
if (url.startsWith('http://api.manoonoils.com/')) {
url = url.replace('http://', 'https://');
input = url;
}
return originalFetch(input, init);
};
import { createAppRegisterHandler } from "@saleor/app-sdk/handlers/next";
import { saleorApp } from "@/saleor-app";
const allowedSaleorUrls = process.env.ALLOWED_SALEOR_URLS
? process.env.ALLOWED_SALEOR_URLS.split(",").map((url) => url.trim())
: ["http://localhost:3000", "https://*.saleor.cloud"];
export default createAppRegisterHandler({
apl: saleorApp.apl,
allowedSaleorUrls: [
"https://api.manoonoils.com/graphql/",
"http://api.manoonoils.com/graphql/",
],
allowedSaleorUrls,
});