Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pantalaimon Damnatio Memoriae Stage 1 #679

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
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 Draupnir 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
21 changes: 8 additions & 13 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,9 @@ function getConfigMeta(): NonNullable<IConfig["configMeta"]> {
process.argv,
"--access-token-path"
),
isPasswordPathOptionUsed: isCommandLineOptionPresent(
process.argv,
"--pantalaimon-password-path"
),
isPasswordPathOptionUsed:
isCommandLineOptionPresent(process.argv, "--pantalaimon-password-path") ||
isCommandLineOptionPresent(process.argv, "--password-path"),
};
}

Expand Down Expand Up @@ -347,18 +346,14 @@ 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) {
config.pantalaimon.password = fs.readFileSync(
explicitPantalaimonPasswordPath,
"utf8"
);
const explicitPasswordPath =
getCommandLineOption(process.argv, "--pantalaimon-password-path") ??
getCommandLineOption(process.argv, "--password-path");
if (explicitPasswordPath) {
config.pantalaimon.password = fs.readFileSync(explicitPasswordPath, "utf8");
}
return config;
}
Expand Down
Loading