mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
5ef889addd
Summary: This moves enough server material into core to run a home server. The data engine is not yet incorporated (though in manual testing it works when ported). Test Plan: existing tests pass Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2552
26 lines
814 B
TypeScript
26 lines
814 B
TypeScript
import {updateDb} from 'app/server/lib/dbUtils';
|
|
import {main as mergedServerMain} from 'app/server/mergedServerMain';
|
|
import * as fse from 'fs-extra';
|
|
|
|
const G = {
|
|
port: parseInt(process.env.PORT!, 10) || 8484,
|
|
};
|
|
|
|
export async function main() {
|
|
// Use a distinct cookie.
|
|
if (!process.env.GRIST_SESSION_COOKIE) {
|
|
process.env.GRIST_SESSION_COOKIE = 'grist_core';
|
|
}
|
|
// This is where documents are placed, for historic reasons.
|
|
await fse.mkdirp('samples');
|
|
// Make a blank db if needed.
|
|
await updateDb();
|
|
// Launch single-port, self-contained version of Grist.
|
|
// You probably want to have GRIST_DEFAULT_EMAIL set since there's no login system yet.
|
|
await mergedServerMain(G.port, ["home", "docs", "static"]);
|
|
}
|
|
|
|
if (require.main === module) {
|
|
main().catch((err) => console.error(err));
|
|
}
|