Allow overriding the API url using an environment variable (#4502)

This commit is contained in:
David Marby
2022-02-16 15:19:19 +01:00
committed by GitHub
parent 0b7a61fdee
commit 837342ddab
2 changed files with 3 additions and 3 deletions

View File

@@ -126,7 +126,7 @@ export enum UpdateURL {
}
// API
export const API_BASE_URL = 'https://api.insomnia.rest';
export const getApiBaseURL = () => process.env.INSOMNIA_API_URL || 'https://api.insomnia.rest';
// SYNC
export const DEFAULT_BRANCH_NAME = 'master';

View File

@@ -2,7 +2,7 @@ import { bindActionCreators, combineReducers, Store } from 'redux';
import * as fetch from '../../../account/fetch';
import { isLoggedIn, onLoginLogout } from '../../../account/session';
import { API_BASE_URL, getClientString } from '../../../common/constants';
import { getApiBaseURL, getClientString } from '../../../common/constants';
import { database as db } from '../../../common/database';
import configureStore from '../create';
import * as entities from './entities';
@@ -25,7 +25,7 @@ export async function init(): Promise<Store> {
loginStateChange(loggedIn);
});
// Bind to fetch commands
fetch.setup(getClientString(), API_BASE_URL);
fetch.setup(getClientString(), getApiBaseURL());
fetch.onCommand(newCommand);
for (const action of global.init()) {