mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 20:44:05 +09:00
fix: Env variables
This commit is contained in:
1 parent
c21413eef0
commit
4866287d19
4 files changed
+10
-10
No files matched your search
@@ -20,6 +20,6 @@ S3_SECRET_ACCESS_KEY=
|
||||
ASSET_CDN_URL=
|
||||
|
||||
# Publish to edge
|
||||
EDGE_PUBLISHER_ENDPOINT=
|
||||
EDGE_DOMAIN=
|
||||
EDGE_TOKEN=
|
||||
PUBLISHER_ENDPOINT=
|
||||
PUBLISHER_DOMAIN=
|
||||
PUBLISHER_TOKEN=
|
||||
@@ -20,8 +20,8 @@ import env from "~/shared/env";
|
||||
type PublishButtonProps = { project: Project };
|
||||
|
||||
const host = () => {
|
||||
if (env.EDGE_PUBLISHER_ENDPOINT && env.EDGE_DOMAIN !== "") {
|
||||
return env.EDGE_DOMAIN;
|
||||
if (env.PUBLISHER_ENDPOINT && env.PUBLISHER_DOMAIN !== "") {
|
||||
return env.PUBLISHER_DOMAIN;
|
||||
}
|
||||
if (typeof location === "object") {
|
||||
if (location.host.includes("webstudio.is")) return "wstd.io";
|
||||
|
||||
@@ -5,8 +5,8 @@ const env = {
|
||||
VERCEL_ENV: process.env.VERCEL_ENV,
|
||||
DEBUG: process.env.DEBUG,
|
||||
FEATURES: process.env.FEATURES,
|
||||
EDGE_PUBLISHER_ENDPOINT: process.env.EDGE_PUBLISHER_ENDPOINT,
|
||||
EDGE_DOMAIN: process.env.EDGE_DOMAIN,
|
||||
PUBLISHER_ENDPOINT: process.env.PUBLISHER_ENDPOINT,
|
||||
PUBLISHER_DOMAIN: process.env.PUBLISHER_DOMAIN,
|
||||
} as const;
|
||||
|
||||
export default env;
|
||||
|
||||
@@ -10,11 +10,11 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
}
|
||||
try {
|
||||
await db.misc.publish({ projectId, domain });
|
||||
if (process.env.EDGE_PUBLISHER_ENDPOINT) {
|
||||
if (process.env.PUBLISHER_ENDPOINT) {
|
||||
const headers = new Headers();
|
||||
headers.append("X-AUTH-WEBSTUDIO", process.env.EDGE_TOKEN || "");
|
||||
headers.append("X-AUTH-WEBSTUDIO", process.env.PUBLISHER_TOKEN || "");
|
||||
headers.append("Content-Type", "text/plain");
|
||||
const response = await fetch(process.env.EDGE_PUBLISHER_ENDPOINT, {
|
||||
const response = await fetch(process.env.PUBLISHER_ENDPOINT, {
|
||||
method: "PUT",
|
||||
headers,
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in new issue
Block a user