-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
capacitor.config.ts
46 lines (40 loc) · 1013 Bytes
/
capacitor.config.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {CapacitorConfig} from '@capacitor/cli';
import {networkInterfaces} from 'os';
import {env} from './env';
const config: CapacitorConfig = {
appId: 'mt.sign.translate',
appName: 'sign',
webDir: 'dist/sign-translate/browser',
server: getServer(),
plugins: {
SplashScreen: {
androidScaleType: 'CENTER_CROP',
launchAutoHide: false,
},
},
ios: {
path: 'ios',
webContentsDebuggingEnabled: true,
},
android: {
path: 'android',
useLegacyBridge: false,
},
};
function getServer(): CapacitorConfig['server'] {
if (!env.ENABLE_CAPACITOR_SERVER) {
return undefined;
}
const ip = (() => {
if (env.OVERRIDE_CAPACITOR_SERVER) {
return env.OVERRIDE_CAPACITOR_SERVER;
}
const networks = networkInterfaces()['en0'] ?? networkInterfaces()['eth0'];
return networks.find(ip => ip.family === 'IPv4')?.address;
})();
return {
url: `http://${ip}:${env.CAPACITOR_SERVER_PORT}`,
cleartext: true,
};
}
export default config;