mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) move home server into core
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
This commit is contained in:
25
stubs/app/server/server.ts
Normal file
25
stubs/app/server/server.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user