INNER CODE UNIT · TypeScript
loadConfig
OutlineFoundation/outline-server · src/metrics_server/index.ts:29
function loadConfig(): Config {
const configText = fs.readFileSync(path.join(__dirname, 'config.json'), {encoding: 'utf8'});
return JSON.parse(configText);
}
const PORT = Number(process.env.PORT) || 8080;
const config = loadConfig();
const bigqueryDataset = new BigQuery({projectId: 'uproxysite'}).dataset(config.datasetName);
const connectionsTable = new connections.BigQueryConnectionsTable(
bigqueryDataset.table(config.connectionMetricsTableName)
);
const featuresTable = new features.BigQueryFeaturesTable(
bigqueryDataset.table(config.featureMetricsTableName)
);
const app = express();
// Parse the request body for content-type 'application/json'.