Skip to content

Commit

Permalink
fix: use file based config
Browse files Browse the repository at this point in the history
  • Loading branch information
elcharitas committed Nov 25, 2023
1 parent c7f1cc5 commit 2778806
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
.ceramic
node_modules
daemon.config.json
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ COPY yarn.lock ./
RUN yarn
COPY run.mjs ./

RUN node run.mjs
COPY daemon.config.json ./

EXPOSE 7007

CMD ["npm", "run", "start"]
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "",
"main": "run.mjs",
"scripts": {
"dev": "ceramic daemon",
"start": "node run.mjs"
"start": "ceramic daemon --config ./daemon.config.json"
},
"keywords": [],
"author": "",
Expand All @@ -16,4 +15,4 @@
"dependencies": {
"@ceramicnetwork/cli": "3.0.4"
}
}
}
10 changes: 8 additions & 2 deletions run.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DaemonConfig, CeramicDaemon } from "@ceramicnetwork/cli";
import { DaemonConfig } from "@ceramicnetwork/cli";
import { writeFile } from "fs";

const generateConfig = (adminDid, dbUrl) => {
return DaemonConfig.fromObject({
Expand Down Expand Up @@ -35,4 +36,9 @@ const generateConfig = (adminDid, dbUrl) => {
};

const config = generateConfig(process.env.ADMIN_DID, process.env.DB_URL);
CeramicDaemon.create(config);

writeFile("./daemon.config.json", JSON.stringify(config), (err) => {
if (err) {
console.error(err);
}
});

0 comments on commit 2778806

Please sign in to comment.