Skip to content

Commit

Permalink
Pantalaimon Damnatio Memoriae Stage 1
Browse files Browse the repository at this point in the history
  • Loading branch information
FSG-Cat committed Jan 17, 2025
1 parent a16fb7b commit 97425e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
12 changes: 4 additions & 8 deletions config/default.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Endpoint URL that Draupnir uses to interact with the matrix homeserver (client-server API),
# set this to the pantalaimon URL if you're using that.
homeserverUrl: "https://matrix.org"

# Endpoint URL that Draupnir could use to fetch events related to reports (client-server API and /_synapse/),
Expand All @@ -11,12 +10,9 @@ rawHomeserverUrl: "https://matrix.org"
# which would allow using secret management systems such as systemd's service credentials.
accessToken: "YOUR_TOKEN_HERE"

# Options related to Pantalaimon (https://github.com/matrix-org/pantalaimon)
# Options related to having the bot login itself.
pantalaimon:
# Whether or not Draupnir will use pantalaimon to access the matrix homeserver,
# set to `true` if you're using pantalaimon.
#
# Be sure to point homeserverUrl to the pantalaimon instance.
# Set to `true` when the bot is to login and fetch the access token on its own.
#
# Draupnir will log in using the given username and password once,
# then store the resulting access token in a file under dataPath.
Expand All @@ -28,13 +24,13 @@ pantalaimon:
# The password Draupnir will login with.
#
# After successfully logging in once, this will be ignored, so this value can be blanked after first startup.
# This option can be loaded from a file by passing "--pantalaimon-password-path <path>" at the command line,
# This option can be loaded from a file by passing "--password-path <path>" at the command line,
# which would allow using secret management systems such as systemd's service credentials.
password: your_password

# Experimental usage of the matrix-bot-sdk rust crypto.
# This can not be used with Pantalaimon.
# Make sure to setup the bot as if you are not using pantalaimon for this.
# Make sure Pantalaimon is disabled in Draupnir's configuration.
#
# Warning: At this time this is not considered production safe.
experimentalRustCrypto: false
Expand Down
18 changes: 12 additions & 6 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ function getConfigMeta(): NonNullable<IConfig["configMeta"]> {
isPasswordPathOptionUsed: isCommandLineOptionPresent(

Check failure on line 302 in src/config.ts

View workflow job for this annotation

GitHub Actions / Build & Lint

Unnecessary conditional, expected left-hand side of `??` operator to be possibly null or undefined
process.argv,
"--pantalaimon-password-path"
) ?? isCommandLineOptionPresent(
process.argv,
"--password-path"
),
};
}
Expand Down Expand Up @@ -347,16 +350,19 @@ export function configRead(): IConfig {
process.argv,
"--access-token-path"
);
const explicitPantalaimonPasswordPath = getCommandLineOption(
process.argv,
"--pantalaimon-password-path"
);
if (explicitAccessTokenPath !== undefined) {
config.accessToken = fs.readFileSync(explicitAccessTokenPath, "utf8");
}
if (explicitPantalaimonPasswordPath) {
const explicitPasswordPath = getCommandLineOption(
process.argv,
"--pantalaimon-password-path"
)?? getCommandLineOption(
process.argv,
"--password-path"
);
if (explicitPasswordPath) {
config.pantalaimon.password = fs.readFileSync(
explicitPantalaimonPasswordPath,
explicitPasswordPath,
"utf8"
);
}
Expand Down

0 comments on commit 97425e2

Please sign in to comment.