diff --git a/README.md b/README.md index 8a8a2e3f..967fc9f2 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,12 @@ - Preferred: set a full `MONGO_URL` (example: `mongodb://user:pass@host:27017/indiekit?authSource=admin`). - If `MONGO_URL` is not set, config builds the URL from `MONGO_USERNAME`, `MONGO_PASSWORD`, `MONGO_HOST`, `MONGO_PORT`, `MONGO_DATABASE`, `MONGO_AUTH_SOURCE`. -- For `MongoServerError: Authentication failed`, first verify `MONGO_PASSWORD`, then try `MONGO_AUTH_SOURCE=admin`. \ No newline at end of file +- For `MongoServerError: Authentication failed`, first verify `MONGO_PASSWORD`, then try `MONGO_AUTH_SOURCE=admin`. + +## GitHub tokens + +- Recommended for two-repo setups: +- `GH_CONTENT_TOKEN`: token for content repo (`blog`), used by `@indiekit/store-github`. +- `GH_ACTIVITY_TOKEN`: token for GitHub dashboard/activity endpoint, used by `@rmdes/indiekit-endpoint-github`. +- `GITHUB_USERNAME`: GitHub user/owner name. +- Backward compatibility: if `GH_CONTENT_TOKEN` or `GH_ACTIVITY_TOKEN` are not set, config falls back to `GITHUB_TOKEN`. \ No newline at end of file diff --git a/indiekit.config.mjs b/indiekit.config.mjs index ce9c1d20..d97f4bf6 100644 --- a/indiekit.config.mjs +++ b/indiekit.config.mjs @@ -22,6 +22,12 @@ const mongoUrl = process.env.MONGO_URL || `mongodb://${mongoCredentials}${mongoHost}:${mongoPort}/${mongoDatabase}${mongoQuery}`; +const githubUsername = process.env.GITHUB_USERNAME || "svemagie"; +const githubContentToken = + process.env.GH_CONTENT_TOKEN || process.env.GITHUB_TOKEN; +const githubActivityToken = + process.env.GH_ACTIVITY_TOKEN || process.env.GITHUB_TOKEN; + export default { debug: "indiekit:*", application: { @@ -66,16 +72,17 @@ export default { //"@rmdes/indiekit-endpoint-activitypub", ], "@indiekit/store-github": { - user: "svemagie", + user: githubUsername, repo: "blog", branch: "main", + token: githubContentToken, }, "@rmdes/indiekit-endpoint-posts": { mountPath: "/blog", }, "@rmdes/indiekit-endpoint-github": { - token: process.env.GITHUB_TOKEN, - user: "svemagie", + token: githubActivityToken, + username: githubUsername, }, "@rmdes/indiekit-endpoint-webmention-io": { token: process.env.WEBMENTION_IO_TOKEN,