mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-21 06:03:13 +02:00
Change environment variables strategy
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
12
src/utils/config.util.ts
Normal 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 };
|
||||
Reference in New Issue
Block a user