Change environment variables strategy

This commit is contained in:
Elias Schneider
2022-05-02 08:22:53 +02:00
parent 961967f57a
commit 1c90cf63ce
11 changed files with 67 additions and 26 deletions

View File

@@ -3,7 +3,6 @@ import { Appwrite } from "appwrite";
// SDK for client side (browser)
const aw = new Appwrite();
aw.setEndpoint(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string)
.setProject("pingvin-share");
aw.setProject("pingvin-share");
export default aw;

View File

@@ -5,7 +5,7 @@ const client = new sdk.Client();
client
.setEndpoint(
(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace(
(process.env["PUBLIC_APPWRITE_HOST"] as string).replace(
"localhost",
process.env.NODE_ENV == "production"
? "host.docker.internal"

12
src/utils/config.util.ts Normal file
View File

@@ -0,0 +1,12 @@
import axios from "axios";
import { createContext, useContext } from "react";
export const ConfigContext = createContext<any>({});
export const useConfig = () => useContext(ConfigContext);
const getGonfig = async() => {
return (await axios.get("/api/config")).data;
};
export default { getGonfig };