Add docker envs

This commit is contained in:
Lukasz Ostrowski 2023-06-28 16:11:47 +02:00
parent 04cf93ca22
commit 5b576fa8d3
31 changed files with 224 additions and 86 deletions

View file

@ -0,0 +1,15 @@
---
"saleor-app-emails-and-messages": minor
"saleor-app-data-importer": minor
"saleor-app-products-feed": minor
"saleor-app-monitoring": minor
"saleor-app-invoices": minor
"saleor-app-klaviyo": minor
"saleor-app-search": minor
"saleor-app-slack": minor
"saleor-app-taxes": minor
"saleor-app-cms": minor
"saleor-app-crm": minor
---
Added additional ENV variables (see each app's .env.example), that can overwrite app base URL. This change allows easy apps development using Docker

View file

@ -8,3 +8,10 @@ REST_APL_ENDPOINT=
REST_APL_TOKEN= REST_APL_TOKEN=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -8,19 +8,22 @@ import { productVariantDeletedWebhook } from "./webhooks/product-variant-deleted
import { productUpdatedWebhook } from "./webhooks/product-updated"; import { productUpdatedWebhook } from "./webhooks/product-updated";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "CMS", name: "CMS",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: ["MANAGE_PRODUCTS"], permissions: ["MANAGE_PRODUCTS"],
id: "saleor.app.cms", id: "saleor.app.cms",
version: packageJson.version, version: packageJson.version,
webhooks: [ webhooks: [
productVariantCreatedWebhook.getWebhookManifest(context.appBaseUrl), productVariantCreatedWebhook.getWebhookManifest(apiBaseURL),
productVariantUpdatedWebhook.getWebhookManifest(context.appBaseUrl), productVariantUpdatedWebhook.getWebhookManifest(apiBaseURL),
productVariantDeletedWebhook.getWebhookManifest(context.appBaseUrl), productVariantDeletedWebhook.getWebhookManifest(apiBaseURL),
productUpdatedWebhook.getWebhookManifest(context.appBaseUrl), productUpdatedWebhook.getWebhookManifest(apiBaseURL),
], ],
extensions: [], extensions: [],
author: "Saleor Commerce", author: "Saleor Commerce",
@ -29,7 +32,7 @@ export default createManifestHandler({
dataPrivacyUrl: "https://saleor.io/legal/privacy/", dataPrivacyUrl: "https://saleor.io/legal/privacy/",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -18,7 +18,9 @@
"SENTRY_PROJECT", "SENTRY_PROJECT",
"SENTRY_ORG", "SENTRY_ORG",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"SENTRY_ENVIRONMENT" "SENTRY_ENVIRONMENT",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -9,4 +9,11 @@ REST_APL_TOKEN=
MAILCHIMP_CLIENT_ID= MAILCHIMP_CLIENT_ID=
MAILCHIMP_CLIENT_SECRET= MAILCHIMP_CLIENT_SECRET=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -6,11 +6,14 @@ import { customerCreatedWebhook } from "./webhooks/customer-created";
import { customerMetadataUpdatedWebhook } from "./webhooks/customer-updated"; import { customerMetadataUpdatedWebhook } from "./webhooks/customer-updated";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "CRM", name: "CRM",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: [ permissions: [
"MANAGE_USERS", "MANAGE_USERS",
/** /**
@ -21,8 +24,8 @@ export default createManifestHandler({
id: "saleor.app.crm", id: "saleor.app.crm",
version: packageJson.version, version: packageJson.version,
webhooks: [ webhooks: [
customerCreatedWebhook.getWebhookManifest(context.appBaseUrl), customerCreatedWebhook.getWebhookManifest(apiBaseURL),
customerMetadataUpdatedWebhook.getWebhookManifest(context.appBaseUrl), customerMetadataUpdatedWebhook.getWebhookManifest(apiBaseURL),
], ],
extensions: [ extensions: [
/** /**
@ -36,7 +39,7 @@ export default createManifestHandler({
author: "Saleor Commerce", author: "Saleor Commerce",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -19,7 +19,9 @@
"SENTRY_PROJECT", "SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"SENTRY_ORG", "SENTRY_ORG",
"SENTRY_ENVIRONMENT" "SENTRY_ENVIRONMENT",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -2,4 +2,11 @@
NEXT_PUBLIC_NUVO_LICENSE_KEY= NEXT_PUBLIC_NUVO_LICENSE_KEY=
NEXT_PUBLIC_NUVO_PROD_MODE=false NEXT_PUBLIC_NUVO_PROD_MODE=false
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -4,11 +4,14 @@ import { AppManifest } from "@saleor/app-sdk/types";
import packageJson from "../../../package.json"; import packageJson from "../../../package.json";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Data Importer", name: "Data Importer",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: ["MANAGE_USERS"], permissions: ["MANAGE_USERS"],
id: "saleor.app.data-importer", id: "saleor.app.data-importer",
version: packageJson.version, version: packageJson.version,
@ -31,7 +34,7 @@ export default createManifestHandler({
author: "Saleor Commerce", author: "Saleor Commerce",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -22,7 +22,9 @@
"SENTRY_ORG", "SENTRY_ORG",
"SENTRY_DSN", "SENTRY_DSN",
"SENTRY_ENVIRONMENT", "SENTRY_ENVIRONMENT",
"NEXT_PUBLIC_SENTRY_DSN" "NEXT_PUBLIC_SENTRY_DSN",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -7,4 +7,11 @@ APL=
REST_APL_ENDPOINT= REST_APL_ENDPOINT=
REST_APL_TOKEN= REST_APL_TOKEN=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -4,11 +4,14 @@ import { AppManifest } from "@saleor/app-sdk/types";
import packageJson from "../../../package.json"; import packageJson from "../../../package.json";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Emails & Messages", name: "Emails & Messages",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: ["MANAGE_ORDERS", "MANAGE_USERS"], permissions: ["MANAGE_ORDERS", "MANAGE_USERS"],
id: "saleor.app.emails-and-messages", id: "saleor.app.emails-and-messages",
version: packageJson.version, version: packageJson.version,
@ -28,7 +31,7 @@ export default createManifestHandler({
requiredSaleorVersion: ">=3.10 <4", requiredSaleorVersion: ">=3.10 <4",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -19,7 +19,9 @@
"SENTRY_DSN", "SENTRY_DSN",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_SENTRY_DSN",
"SENTRY_ENVIRONMENT" "SENTRY_ENVIRONMENT",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -8,4 +8,11 @@ APP_LOG_LEVEL=info
# See api/register.tsx # See api/register.tsx
# Leave empty to allow all domains # Leave empty to allow all domains
# Example: "https:\/\/.*.saleor.cloud\/graphql\/" to enable Saleor Cloud APIs # Example: "https:\/\/.*.saleor.cloud\/graphql\/" to enable Saleor Cloud APIs
ALLOWED_DOMAIN_PATTERN= ALLOWED_DOMAIN_PATTERN=
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -6,9 +6,9 @@ import { invoiceRequestedWebhook } from "./webhooks/invoice-requested";
import { REQUIRED_SALEOR_VERSION } from "../../saleor-app"; import { REQUIRED_SALEOR_VERSION } from "../../saleor-app";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? context.appBaseUrl; const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? context.appBaseUrl; const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Invoices", name: "Invoices",

View file

@ -8,4 +8,11 @@ ALLOWED_DOMAIN_PATTERN=
# Encryption key used by the EncryptedSettingsManager. Required by the production builds # Encryption key used by the EncryptedSettingsManager. Required by the production builds
SECRET_KEY= SECRET_KEY=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -11,18 +11,21 @@ const handler = createManifestHandler({
async manifestFactory(context): Promise<AppManifest> { async manifestFactory(context): Promise<AppManifest> {
const { appBaseUrl } = context; const { appBaseUrl } = context;
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
return { return {
id: "saleor.app.klaviyo", id: "saleor.app.klaviyo",
version: pkg.version, version: pkg.version,
name: "Klaviyo", name: "Klaviyo",
permissions: ["MANAGE_USERS", "MANAGE_ORDERS"], permissions: ["MANAGE_USERS", "MANAGE_ORDERS"],
appUrl: appBaseUrl, appUrl: iframeBaseUrl,
tokenTargetUrl: `${appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
webhooks: [ webhooks: [
customerCreatedWebhook.getWebhookManifest(appBaseUrl), customerCreatedWebhook.getWebhookManifest(apiBaseURL),
fulfillmentCreatedWebhook.getWebhookManifest(appBaseUrl), fulfillmentCreatedWebhook.getWebhookManifest(apiBaseURL),
orderCreatedWebhook.getWebhookManifest(appBaseUrl), orderCreatedWebhook.getWebhookManifest(apiBaseURL),
orderFullyPaidWebhook.getWebhookManifest(appBaseUrl), orderFullyPaidWebhook.getWebhookManifest(apiBaseURL),
], ],
supportUrl: "https://github.com/saleor/apps/discussions", supportUrl: "https://github.com/saleor/apps/discussions",
homepageUrl: "https://github.com/saleor/apps", homepageUrl: "https://github.com/saleor/apps",
@ -30,7 +33,7 @@ const handler = createManifestHandler({
author: "Saleor Commerce", author: "Saleor Commerce",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -18,7 +18,9 @@
"SENTRY_PROJECT", "SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_VERCEL_ENV", "NEXT_PUBLIC_VERCEL_ENV",
"SENTRY_ENVIRONMENT" "SENTRY_ENVIRONMENT",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -1 +1,8 @@
MONITORING_APP_API_URL= MONITORING_APP_API_URL=
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -18,7 +18,9 @@
"SENTRY_PROJECT", "SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_VERCEL_ENV", "NEXT_PUBLIC_VERCEL_ENV",
"MONITORING_APP_API_URL" "MONITORING_APP_API_URL",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -1 +1,18 @@
APP_DEBUG=info APL=file
# Optional
# Regex pattern consumed conditionally to restrcit app installation to specific urls.
# See api/register.tsx
# Leave empty to allow all domains
# Example: "https:\/\/.*.saleor.cloud\/graphql\/" to enable Saleor Cloud APIs
ALLOWED_DOMAIN_PATTERN=
# Encryption key used by the EncryptedSettingsManager. Required by the production builds
SECRET_KEY=
APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -9,9 +9,9 @@ import { webhookProductVariantDeleted } from "./webhooks/product_variant_deleted
import { webhookProductVariantUpdated } from "./webhooks/product_variant_updated"; import { webhookProductVariantUpdated } from "./webhooks/product_variant_updated";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? context.appBaseUrl; const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? context.appBaseUrl; const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Product Feed", name: "Product Feed",

View file

@ -1,4 +1,11 @@
# Encryption key used by the EncryptedSettingsManager. Required by the production builds # Encryption key used by the EncryptedSettingsManager. Required by the production builds
SECRET_KEY= SECRET_KEY=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -10,11 +10,14 @@ import { webhookProductVariantDeleted } from "./webhooks/saleor/product_variant_
import { webhookProductVariantUpdated } from "./webhooks/saleor/product_variant_updated"; import { webhookProductVariantUpdated } from "./webhooks/saleor/product_variant_updated";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Search", name: "Search",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: [ permissions: [
/** /**
* Set permissions for app if needed * Set permissions for app if needed
@ -31,12 +34,12 @@ export default createManifestHandler({
* Read more * Read more
* https://docs.saleor.io/docs/3.x/developer/api-reference/objects/webhook * https://docs.saleor.io/docs/3.x/developer/api-reference/objects/webhook
*/ */
webhookProductCreated.getWebhookManifest(context.appBaseUrl), webhookProductCreated.getWebhookManifest(apiBaseURL),
webhookProductDeleted.getWebhookManifest(context.appBaseUrl), webhookProductDeleted.getWebhookManifest(apiBaseURL),
webhookProductUpdated.getWebhookManifest(context.appBaseUrl), webhookProductUpdated.getWebhookManifest(apiBaseURL),
webhookProductVariantCreated.getWebhookManifest(context.appBaseUrl), webhookProductVariantCreated.getWebhookManifest(apiBaseURL),
webhookProductVariantDeleted.getWebhookManifest(context.appBaseUrl), webhookProductVariantDeleted.getWebhookManifest(apiBaseURL),
webhookProductVariantUpdated.getWebhookManifest(context.appBaseUrl), webhookProductVariantUpdated.getWebhookManifest(apiBaseURL),
], ],
extensions: [ extensions: [
/** /**
@ -49,7 +52,7 @@ export default createManifestHandler({
dataPrivacyUrl: "https://saleor.io/legal/privacy/", dataPrivacyUrl: "https://saleor.io/legal/privacy/",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -17,7 +17,9 @@
"SENTRY_ORG", "SENTRY_ORG",
"NEXT_PUBLIC_VERCEL_ENV", "NEXT_PUBLIC_VERCEL_ENV",
"NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_SENTRY_DSN",
"SENTRY_ENVIRONMENT" "SENTRY_ENVIRONMENT",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -1,4 +1,12 @@
# Encryption key used by the EncryptedSettingsManager. Required by the production builds # Encryption key used by the EncryptedSettingsManager. Required by the production builds
SECRET_KEY= SECRET_KEY=
APP_LOG_LEVEL=info APP_LOG_LEVEL=info
# Local development variables. When developped locally with Saleor inside docker, these can be set to:
# APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -5,15 +5,18 @@ import packageJson from "../../../package.json";
import { orderCreatedWebhook } from "./webhooks/order-created"; import { orderCreatedWebhook } from "./webhooks/order-created";
const handler = createManifestHandler({ const handler = createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Slack", name: "Slack",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: ["MANAGE_ORDERS"], permissions: ["MANAGE_ORDERS"],
id: "saleor.app.slack", id: "saleor.app.slack",
version: packageJson.version, version: packageJson.version,
webhooks: [orderCreatedWebhook.getWebhookManifest(context.appBaseUrl)], webhooks: [orderCreatedWebhook.getWebhookManifest(apiBaseURL)],
extensions: [], extensions: [],
author: "Saleor Commerce", author: "Saleor Commerce",
supportUrl: "https://github.com/saleor/apps/discussions", supportUrl: "https://github.com/saleor/apps/discussions",
@ -21,7 +24,7 @@ const handler = createManifestHandler({
dataPrivacyUrl: "https://saleor.io/legal/privacy/", dataPrivacyUrl: "https://saleor.io/legal/privacy/",
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -18,7 +18,9 @@
"SENTRY_PROJECT", "SENTRY_PROJECT",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"SENTRY_ENVIRONMENT", "SENTRY_ENVIRONMENT",
"NEXT_PUBLIC_VERCEL_ENV" "NEXT_PUBLIC_VERCEL_ENV",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }

View file

@ -1,11 +1,11 @@
APL=file # Encryption key used by the EncryptedSettingsManager. Required by the production builds
#"fatal" | "error" | "warn" | "info" | "debug" | "trace"
APP_LOG_LEVEL=info
NODE_ENV=
SECRET_KEY= SECRET_KEY=
PORT=
VERCEL_URL= APP_LOG_LEVEL=info
REST_APL_ENDPOINT=
REST_APL_TOKEN= # Local development variables. When developped locally with Saleor inside docker, these can be set to:
ALLOWED_DOMAIN_PATTERN= # APP_IFRAME_BASE_URL = http://localhost:3000, so Dashboard on host can access iframe
# APP_API_BASE_URL=http://host.docker.internal:3000 - so Saleor can reach App running on host, from the container.
# If developped with tunnels, set this empty, it will fallback to default Next's localhost:3000
APP_IFRAME_BASE_URL=
APP_API_BASE_URL=

View file

@ -9,19 +9,22 @@ import { orderFulfilledAsyncWebhook } from "./webhooks/order-fulfilled";
import { REQUIRED_SALEOR_VERSION } from "../../../saleor-app"; import { REQUIRED_SALEOR_VERSION } from "../../../saleor-app";
export default createManifestHandler({ export default createManifestHandler({
async manifestFactory(context) { async manifestFactory({ appBaseUrl }) {
const iframeBaseUrl = process.env.APP_IFRAME_BASE_URL ?? appBaseUrl;
const apiBaseURL = process.env.APP_API_BASE_URL ?? appBaseUrl;
const manifest: AppManifest = { const manifest: AppManifest = {
name: "Taxes", name: "Taxes",
tokenTargetUrl: `${context.appBaseUrl}/api/register`, tokenTargetUrl: `${apiBaseURL}/api/register`,
appUrl: context.appBaseUrl, appUrl: iframeBaseUrl,
permissions: ["HANDLE_TAXES", "MANAGE_ORDERS"], permissions: ["HANDLE_TAXES", "MANAGE_ORDERS"],
id: "saleor.app.taxes", id: "saleor.app.taxes",
version: packageJson.version, version: packageJson.version,
webhooks: [ webhooks: [
orderCalculateTaxesSyncWebhook.getWebhookManifest(context.appBaseUrl), orderCalculateTaxesSyncWebhook.getWebhookManifest(apiBaseURL),
checkoutCalculateTaxesSyncWebhook.getWebhookManifest(context.appBaseUrl), checkoutCalculateTaxesSyncWebhook.getWebhookManifest(apiBaseURL),
orderCreatedAsyncWebhook.getWebhookManifest(context.appBaseUrl), orderCreatedAsyncWebhook.getWebhookManifest(apiBaseURL),
orderFulfilledAsyncWebhook.getWebhookManifest(context.appBaseUrl), orderFulfilledAsyncWebhook.getWebhookManifest(apiBaseURL),
], ],
extensions: [], extensions: [],
homepageUrl: "https://github.com/saleor/apps", homepageUrl: "https://github.com/saleor/apps",
@ -31,7 +34,7 @@ export default createManifestHandler({
requiredSaleorVersion: REQUIRED_SALEOR_VERSION, requiredSaleorVersion: REQUIRED_SALEOR_VERSION,
brand: { brand: {
logo: { logo: {
default: `${context.appBaseUrl}/logo.png`, default: `${apiBaseURL}/logo.png`,
}, },
}, },
}; };

View file

@ -18,7 +18,9 @@
"SENTRY_DSN", "SENTRY_DSN",
"SENTRY_AUTH_TOKEN", "SENTRY_AUTH_TOKEN",
"SENTRY_ENVIRONMENT", "SENTRY_ENVIRONMENT",
"NEXT_PUBLIC_SENTRY_DSN" "NEXT_PUBLIC_SENTRY_DSN",
"APP_IFRAME_BASE_URL",
"APP_API_BASE_URL"
] ]
} }
} }