Use key from ENV if available
This commit is contained in:
parent
005ac9853f
commit
e4be14f0c8
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.env
|
|
@ -65,7 +65,7 @@ router.get("/", async (_req, res) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context.profile.name) {
|
if (!context.profile.name) {
|
||||||
res.redirect("/about");
|
return res.redirect("/about");
|
||||||
}
|
}
|
||||||
|
|
||||||
const [posts, friends, vanishingMessages] = await Promise.all([
|
const [posts, friends, vanishingMessages] = await Promise.all([
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
const Server = require("ssb-server");
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
|
let homeFolder =
|
||||||
|
process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
|
||||||
|
let ssbFolder = `${homeFolder}/.${process.env.CONFIG_FOLDER || "social"}`;
|
||||||
|
let secretPath = `${ssbFolder}/secret`;
|
||||||
|
let envKey =
|
||||||
|
process.env.SSB_KEY &&
|
||||||
|
Buffer.from(process.env.SSB_KEY, "base64").toString("utf8");
|
||||||
|
if (envKey) {
|
||||||
|
console.log("Using env SSB_KEY");
|
||||||
|
fs.mkdirSync(ssbFolder, { recursive: true });
|
||||||
|
fs.writeFileSync(secretPath, envKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Server = require("ssb-server");
|
||||||
const config = require("./ssb-config");
|
const config = require("./ssb-config");
|
||||||
|
|
||||||
// add plugins
|
// add plugins
|
||||||
|
|
Loading…
Reference in New Issue