Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Claude will then create a `claude_desktop_config.json` file. Open it and add the

This example enables Mastodon and LinkedIn so the `env` key contains the environment variables necessary to post to those services. You can customize the services by passing different command line arguments as you would using the CLI.

If you'd prefer not to put your environment variables directly into the JSON file, you can create a [`.env` file](https://www.npmjs.com/package/dotenv) and use the `CROSSPOST_DOTENV` environment variable to point to it:
If you'd prefer not to put your environment variables directly into the JSON file, you can create a `.env` file and use the `CROSSPOST_DOTENV` environment variable to point to it:

```json
{
Expand Down
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"@modelcontextprotocol/sdk": "^1.8.0",
"@noble/secp256k1": "^3.0.0",
"bech32": "^2.0.0",
"dotenv": "^16.6.1",
"tlds": "^1.255.0",
"twitter-api-v2": "^1.20.2",
"zod": "^3.24.2"
Expand Down
15 changes: 10 additions & 5 deletions src/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import fs from "node:fs";
import { parseArgs } from "node:util";
import * as dotenv from "dotenv";
import { Env } from "@humanwhocodes/env";
import {
Client,
Expand Down Expand Up @@ -134,10 +133,16 @@ if (
// load environment variables from .env file if present
if (process.env.CROSSPOST_DOTENV) {
const filePath =
process.env.CROSSPOST_DOTENV === "1"
? undefined
: process.env.CROSSPOST_DOTENV;
dotenv.config({ path: filePath });
process.env.CROSSPOST_DOTENV === "1" ? ".env" : process.env.CROSSPOST_DOTENV;
try {
process.loadEnvFile(filePath);
} catch (err) {
// Ignore if file doesn't exist, similar to dotenv behavior
const error = /** @type {NodeJS.ErrnoException} */ (err);
if (error.code !== "ENOENT") {
throw error;
}
}
}

const env = new Env();
Expand Down