aboutsummaryrefslogtreecommitdiffstats
path: root/src/environment.js
blob: 7bb2db1345928e6fe7e1f7e51a1ad7efad238193 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { LIVE_API, DEV_API, LOCAL_API } from './config';

export const isDevMode = Boolean(process.execPath.match(/[\\/]electron/));
export const useLiveAPI = process.env.LIVE_API;
export const useLocalAPI = process.env.LOCAL_API;

export const isMac = process.platform === 'darwin';
export const isWindows = process.platform === 'win32';
export const isLinux = process.platform === 'linux';

let ctrlShortcutKey;
if (isMac) {
  ctrlShortcutKey = '⌘';
} else if (isWindows) {
  ctrlShortcutKey = 'Ctrl';
} else {
  ctrlShortcutKey = 'Alt';
}

export const ctrlKey = ctrlShortcutKey;

let api;
if (!isDevMode || (isDevMode && useLiveAPI)) {
  api = LIVE_API;
} else if (isDevMode && useLocalAPI) {
  api = LOCAL_API;
} else {
  api = DEV_API;
}

export const API = api;