import * as dotenv from 'dotenv'; let configPath: string; switch (process.env.NODE_ENV) { case 'test': configPath = `${__dirname}/../../.env.test`; break; default: configPath = `${__dirname}/../../.env.development`; } if (configPath) { dotenv.config({ path: configPath }); } dotenv.config(); let port = +process.env.SPOTIFY_FAKE_PORT; export const getProtocol = () => process.env.SPOTIFY_FAKE_PROTOCOL; export const getDomain = () => process.env.SPOTIFY_FAKE_DOMAIN; export const getPort = () => port; export const setPort = (newPort: number) => (port = newPort); export const getUrl = () => `${getProtocol() ? `://${getProtocol()}` : ''}` + `${getDomain()}${getPort() ? `:${getPort()}` : ''}`;