From e259f10d58938d2b55f6e489fe324945c97f2d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20=C3=81d=C3=A1m?= Date: Sun, 6 Nov 2022 04:19:21 +0200 Subject: [PATCH] Replace .env with config file --- .gitignore | 1 + firebase.ts | 13 +++++++------ src/api/wolt.ts | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 3779384..5a8539b 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ node_modules/ # dotenv .env .env.test +config.ts # macOS .DS_Store diff --git a/firebase.ts b/firebase.ts index aa706c6..36647c2 100644 --- a/firebase.ts +++ b/firebase.ts @@ -1,13 +1,14 @@ import { initializeApp, FirebaseOptions } from 'firebase/app' +import { env } from './config' const config: FirebaseOptions = { - apiKey: process.env.API_KEY, - appId: process.env.APP_ID, - authDomain: process.env.AUTH_DOMAIN, - messagingSenderId: process.env.MESSAGING_SENDER_ID, - projectId: process.env.PROJECT_ID, - storageBucket: process.env.STORAGE_BUCKET + apiKey: env.API_KEY, + appId: env.APP_ID, + authDomain: env.AUTH_DOMAIN, + messagingSenderId: env.MESSAGING_SENDER_ID, + projectId: env.PROJECT_ID, + storageBucket: env.STORAGE_BUCKET } export const app = initializeApp(config) diff --git a/src/api/wolt.ts b/src/api/wolt.ts index f87f2e6..08cf571 100644 --- a/src/api/wolt.ts +++ b/src/api/wolt.ts @@ -1,11 +1,12 @@ import * as Location from 'expo-location' import { LocationObject } from 'expo-location' import { useState } from 'react' +import { env } from '../../config' const baseUrl = 'https://daas-public-api.development.dev.woltapi.com' -const merchantId = process.env.WOLT_MERCHANT_ID -const apiKey = process.env.WOLT_API_KEY +const merchantId = env.WOLT_MERCHANT_ID +const apiKey = env.WOLT_API_KEY const headers = { 'content-type': 'application/json', 'authorization': `Bearer ${apiKey}` } async function getCurrentAddress(): Promise {