diff --git a/api/.env.example b/api/.env.example index 5f307dc106..4e2d76f810 100644 --- a/api/.env.example +++ b/api/.env.example @@ -14,7 +14,7 @@ CONSOLE_URL=http://127.0.0.1:5001 API_URL=http://127.0.0.1:5001 # Web APP base URL -APP_URL=http://127.0.0.1:5001 +APP_URL=http://127.0.0.1:3000 # celery configuration CELERY_BROKER_URL=redis://:difyai123456@localhost:6379/1 diff --git a/web/.env.example b/web/.env.example new file mode 100644 index 0000000000..f4b1e81882 --- /dev/null +++ b/web/.env.example @@ -0,0 +1,9 @@ +EDITION=SELF_HOSTED +# The base URL of console application, refers to the Console base URL of WEB service if console domain is +# different from api or web app domain. +# example: http://cloud.dify.ai +CONSOLE_URL=http://localhost:5001 +# The URL for Web APP, refers to the Web App base URL of WEB service if web app domain is different from +# console or api domain. +# example: http://udify.app +APP_URL=http://localhost:5001 \ No newline at end of file diff --git a/web/env.sh b/web/env.sh new file mode 100755 index 0000000000..7031180d3d --- /dev/null +++ b/web/env.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +[ ! -f .env ] || export $(grep -v '^#' .env | xargs) + +export NEXT_PUBLIC_DEPLOY_ENV=${DEPLOY_ENV} +export NEXT_PUBLIC_EDITION=${EDITION} +export NEXT_PUBLIC_API_PREFIX=${CONSOLE_URL}/console/api +export NEXT_PUBLIC_PUBLIC_API_PREFIX=${APP_URL}/api diff --git a/web/package.json b/web/package.json index 1037ee6f67..f1c0416675 100644 --- a/web/package.json +++ b/web/package.json @@ -3,7 +3,7 @@ "version": "0.2.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "source env.sh && next dev", "build": "next build", "start": "next start", "lint": "next lint",