improve env loading
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { authStore } from '$stores/authStore';
|
import { authStore } from '$stores/authStore';
|
||||||
import { redirect } from '@sveltejs/kit';
|
import { redirect } from '@sveltejs/kit';
|
||||||
import { redisSessionManager } from '$stores/redisSessionManager';
|
import { redisSessionManager } from '$stores/redisSessionManager';
|
||||||
import { API_BASE_URL } from '$env/static/private';
|
import { env } from '$env/dynamic/private';
|
||||||
|
|
||||||
const BASE_URL = API_BASE_URL;
|
const BASE_URL = env.API_BASE_URL;
|
||||||
|
|
||||||
async function fetchAPI(endpoint: string, method: string = 'GET', body?: object, hdr?: object) {
|
async function fetchAPI(endpoint: string, method: string = 'GET', body?: object, hdr?: object) {
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { IoRedisSessionStore } from '@ethercorps/sveltekit-redis-session';
|
import { IoRedisSessionStore } from '@ethercorps/sveltekit-redis-session';
|
||||||
import Redis from 'ioredis';
|
import Redis from 'ioredis';
|
||||||
import { SECRET, REDIS_URL } from '$env/static/private';
|
import { env } from '$env/dynamic/private';
|
||||||
|
|
||||||
// Now we will create new Instance for RedisSessionStore
|
// Now we will create new Instance for RedisSessionStore
|
||||||
const options = {
|
const options = {
|
||||||
redisClient: new Redis(REDIS_URL),
|
redisClient: new Redis(env.REDIS_URL),
|
||||||
secret: SECRET
|
secret: env.SECRET
|
||||||
};
|
};
|
||||||
// These are the required options to use RedisSessionStore.
|
// These are the required options to use RedisSessionStore.
|
||||||
export const redisSessionManager = new IoRedisSessionStore(options);
|
export const redisSessionManager = new IoRedisSessionStore(options);
|
||||||
|
|||||||
Reference in New Issue
Block a user