diff --git a/.env.example b/.env.example index 7f6281db..6ea16385 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ APPWRITE_FUNCTION_API_KEY= # IMPORTANT If you're running the website inside docker and your Appwrite instance runs on localhost host, # use host.docker.internal instead of localhost -APPWRITE_HOST=http://host.docker.internal/v1 +NEXT_PUBLIC_APPWRITE_HOST=http://host.docker.internal/v1 # Must be the same as in the _APP_STORAGE_LIMIT in the Appwrite env file NEXT_PUBLIC_MAX_FILE_SIZE=300000000 \ No newline at end of file diff --git a/.setup/services/api.service.ts b/.setup/services/api.service.ts index 5a87bb49..23557f58 100644 --- a/.setup/services/api.service.ts +++ b/.setup/services/api.service.ts @@ -2,7 +2,7 @@ import axios from "axios"; const api = () => axios.create({ - baseURL: process.env["APPWRITE_HOST"], + baseURL: process.env["NEXT_PUBLIC_APPWRITE_HOST"], headers: { cookie: `a_session_console=${process.env["APPWRITE_USER_TOKEN"]}`, }, diff --git a/.setup/services/aw.service.ts b/.setup/services/aw.service.ts index 1e053d25..2418aff1 100644 --- a/.setup/services/aw.service.ts +++ b/.setup/services/aw.service.ts @@ -3,7 +3,7 @@ const aw = () => { let client = new sdk.Client(); client - .setEndpoint(process.env["APPWRITE_HOST"]) + .setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"]) .setProject("pingvin-share") .setKey(process.env["APPWRITE_API_KEY"]) .setSelfSigned(); diff --git a/README.md b/README.md index 3070333a..f35c646e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ To set up the frontend of Pingvin Share follow these steps. 1. Go to your Appwrite console, visit "API Keys" and copy the "Functions API Key" secret to your clipboard. 2. Rename the `.env.example` file to `.env` 3. Paste the key in the `.env` file -4. Change `APPWRITE_HOST` in the `.env` file to the host where your Appwrite instance runs +4. Change `NEXT_PUBLIC_APPWRITE_HOST` in the `.env` file to the host where your Appwrite instance runs 5. Change `NEXT_PUBLIC_MAX_FILE_SIZE` in the `.env` file to the max file size limit you want Start the frontend: diff --git a/src/utils/appwrite.util.ts b/src/utils/appwrite.util.ts index 2cc12b4f..b940db47 100644 --- a/src/utils/appwrite.util.ts +++ b/src/utils/appwrite.util.ts @@ -3,7 +3,7 @@ import { Appwrite } from "appwrite"; // SDK for client side (browser) const aw = new Appwrite(); -aw.setEndpoint(process.env["APPWRITE_HOST"] as string) +aw.setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string) .setProject("pingvin-share"); export default aw; diff --git a/src/utils/appwriteServer.util.ts b/src/utils/appwriteServer.util.ts index 29aa1016..b6916d6a 100644 --- a/src/utils/appwriteServer.util.ts +++ b/src/utils/appwriteServer.util.ts @@ -4,7 +4,7 @@ import sdk from "node-appwrite"; const client = new sdk.Client(); client - .setEndpoint(process.env["APPWRITE_HOST"] as string) + .setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string) .setProject("pingvin-share") .setKey(process.env["APPWRITE_FUNCTION_API_KEY"] as string);