client config via .env file
This commit is contained in:
@@ -47,7 +47,11 @@ export const NakamaContext = createContext<NakamaContextType>(null!);
|
|||||||
|
|
||||||
export function NakamaProvider({ children }: { children: React.ReactNode }) {
|
export function NakamaProvider({ children }: { children: React.ReactNode }) {
|
||||||
const [client] = useState(
|
const [client] = useState(
|
||||||
() => new Client("defaultkey", "127.0.0.1", "7350")
|
() => new Client(
|
||||||
|
import.meta.env.VITE_WS_SKEY,
|
||||||
|
import.meta.env.VITE_WS_HOST,
|
||||||
|
import.meta.env.VITE_WS_PORT
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const [session, setSession] = useState<Session | null>(null);
|
const [session, setSession] = useState<Session | null>(null);
|
||||||
|
|||||||
4
src/vite-env.d.ts
vendored
4
src/vite-env.d.ts
vendored
@@ -1,7 +1,9 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_WS_BASE_URL: string;
|
readonly VITE_WS_HOST: string;
|
||||||
|
readonly VITE_WS_PORT: string;
|
||||||
|
readonly VITE_WS_SKEY: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user