Extract environment config initialisation to server-core
Summary: This diff makes most stuff that is read from the `os` package, and version info etc available from the `serverConfig` object, so that flipper-ui-core no longer needs the `os` package. Reviewed By: passy Differential Revision: D32694848 fbshipit-source-id: 93af1e95d898da9aaf351a6970b5a7652ee835c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
de59bbedd2
commit
2a4fe77404
@@ -12,6 +12,7 @@ import os from 'os';
|
||||
import yargs from 'yargs';
|
||||
import {
|
||||
FlipperServerImpl,
|
||||
getEnvironmentInfo,
|
||||
loadLauncherSettings,
|
||||
loadProcessConfig,
|
||||
loadSettings,
|
||||
@@ -21,6 +22,7 @@ import {
|
||||
Logger,
|
||||
DeviceDescription,
|
||||
setLoggerInstance,
|
||||
parseEnvironmentVariables,
|
||||
} from 'flipper-common';
|
||||
import path from 'path';
|
||||
import {stdout} from 'process';
|
||||
@@ -54,6 +56,7 @@ const argv = yargs
|
||||
|
||||
async function start(deviceTitle: string, appName: string, pluginId: string) {
|
||||
return new Promise(async (_resolve, reject) => {
|
||||
const staticPath = path.resolve(__dirname, '..', '..', 'static');
|
||||
let device: DeviceDescription | undefined;
|
||||
let deviceResolver: () => void;
|
||||
const devicePromise: Promise<void> = new Promise((resolve) => {
|
||||
@@ -68,15 +71,16 @@ async function start(deviceTitle: string, appName: string, pluginId: string) {
|
||||
console.debug = () => {};
|
||||
console.info = console.error;
|
||||
|
||||
const environmentInfo = await getEnvironmentInfo(staticPath, false);
|
||||
// TODO: initialise FB user manager to be able to do certificate exchange
|
||||
|
||||
const server = new FlipperServerImpl(
|
||||
{
|
||||
env: process.env,
|
||||
environmentInfo,
|
||||
env: parseEnvironmentVariables(process.env),
|
||||
gatekeepers: {},
|
||||
isProduction: false,
|
||||
paths: {
|
||||
staticPath: path.resolve(__dirname, '..', '..', 'static'),
|
||||
staticPath,
|
||||
tempPath: os.tmpdir(),
|
||||
appPath: `/dev/null`,
|
||||
homePath: `/dev/null`,
|
||||
|
||||
Reference in New Issue
Block a user