Support passing env values

This commit is contained in:
rotimi-best
2021-07-27 22:18:23 +03:00
parent 2e596cd6fb
commit b5e969a929
7 changed files with 46 additions and 37 deletions
@@ -5,7 +5,7 @@
import { questionnaireMetaData } from "./store/answers";
export let open;
export let onClose;
export let submissionId;
// export let submissionId;
// get submission data by submissionId;
+8 -16
View File
@@ -1,17 +1,9 @@
let ENV = process.env;
export const getConfig = (_env) => {
if (!!_env) {
ENV = { ...ENV, ..._env };
}
return {
port: ENV.PORT,
nodeEnv: ENV.NODE_ENV,
isProd: ENV.NODE_ENV === 'development',
supabaseConfig: {
url: ENV.SVELTE_APP_SUPABASE_URL,
anonKey: ENV.SVELTE_APP_SUPABASE_ANON_KEY,
},
};
export default {
port: process.env.PORT,
nodeEnv: process.env.NODE_ENV,
isProd: process.env.NODE_ENV === 'development',
supabaseConfig: {
url: process.env.SVELTE_APP_SUPABASE_URL,
anonKey: process.env.SVELTE_APP_SUPABASE_ANON_KEY,
},
};
+1 -3
View File
@@ -5,9 +5,7 @@ import polka from 'polka';
import compression from 'compression';
import * as sapper from '@sapper/server';
import { getConfig } from './config';
const config = getConfig(dotenv.config().parsed);
import config from './config';
polka() // You can also use Express
.use(
+1 -2
View File
@@ -1,7 +1,6 @@
import { createClient } from '@supabase/supabase-js';
import getConfig from '../../config';
const config = getConfig();
import config from '../../config';
export const supabase = createClient(
config.supabaseConfig.url,