Skip to content

Commit

Permalink
Persist cookie signing secret across restarts, closes #69
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Sep 8, 2021
1 parent 9f3c74d commit 8d2c1b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const util = require("util");
const execFile = util.promisify(cp.execFile);
const mkdir = util.promisify(fs.mkdir);

const RANDOM_SECRET = crypto.randomBytes(32).toString("hex");

function configureWindow(window) {
window.webContents.on("will-navigate", function (event, reqUrl) {
// Links to external sites should open in system browser
Expand Down Expand Up @@ -129,6 +131,7 @@ class DatasetteServer {
const process = cp.spawn(datasette_bin, this.serverArgs(), {
env: {
DATASETTE_API_TOKEN: this.apiToken,
DATASETTE_SECRET: RANDOM_SECRET,
},
});
this.process = process;
Expand Down

0 comments on commit 8d2c1b9

Please sign in to comment.