mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) add minimal support for activation keys
Summary: For grist-ee, expect an activation key in environment variable `GRIST_ACTIVATION` or in a file pointed to by `GRIST_ACTIVATION_FILE`. In absence of key, start a 30-day trial, during which a banner is shown. Once trial expires, installation goes into document-read-only mode. Test Plan: added a test Reviewers: dsagal Reviewed By: dsagal Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3426
This commit is contained in:
@@ -12,6 +12,7 @@ import {ApiServer} from 'app/gen-server/ApiServer';
|
||||
import {Document} from "app/gen-server/entity/Document";
|
||||
import {Organization} from "app/gen-server/entity/Organization";
|
||||
import {Workspace} from 'app/gen-server/entity/Workspace';
|
||||
import {Activations} from 'app/gen-server/lib/Activations';
|
||||
import {DocApiForwarder} from 'app/gen-server/lib/DocApiForwarder';
|
||||
import {getDocWorkerMap} from 'app/gen-server/lib/DocWorkerMap';
|
||||
import {HomeDBManager} from 'app/gen-server/lib/HomeDBManager';
|
||||
@@ -470,6 +471,9 @@ export class FlexServer implements GristServer {
|
||||
await this._dbManager.initializeSpecialIds();
|
||||
// Report which database we are using, without sensitive credentials.
|
||||
this.info.push(['database', getDatabaseUrl(this._dbManager.connection.options, false)]);
|
||||
// If the installation appears to be new, give it an id and a creation date.
|
||||
const activations = new Activations(this._dbManager);
|
||||
await activations.current();
|
||||
}
|
||||
|
||||
public addDocWorkerMap() {
|
||||
@@ -566,6 +570,12 @@ export class FlexServer implements GristServer {
|
||||
this._billing.addEventHandlers();
|
||||
}
|
||||
|
||||
public async addBillingMiddleware() {
|
||||
if (this._check('activation', 'homedb')) { return; }
|
||||
this._getBilling();
|
||||
await this._billing.addMiddleware?.(this.app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a /api/log endpoint that simply outputs client errors to our
|
||||
* logs. This is a minimal placeholder for a special-purpose
|
||||
|
||||
Reference in New Issue
Block a user