Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit 4eff21f

Browse files
committed
add setting aliases
Added aliases for settings that contain an underscore so that environment variables can be used to set them easily.
1 parent c70044b commit 4eff21f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ If you're contributing to highlights, I recommend moving the `pre-commit` file t
4242
Highlights is configured using a TOML file at `./config.toml` by default. To use a different path, set the `HIGHLIGHTS_CONFIG` environment variable. The default config with documentation is provided [here](example_config.toml). All options can be set using environment variables using this format: `HIGHLIGHTS_SECTION_PROPERTY`. Examples:
4343
```
4444
HIGHLIGHTS_BOT_TOKEN="your bot token goes here"
45+
HIGHLIGHTS_BOT_APPLICATIONID="your discord application id (not bot token) here"
4546
HIGHLIGHTS_DATABASE_PATH="highlights_data"
4647
```
48+
As in the above example, underscores in property names should be removed so that they aren't interpreted as section separators.
4749

4850
## Backups
4951

src/settings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ pub(crate) use user_address::UserAddress;
204204
#[derive(Debug, Deserialize)]
205205
pub(crate) struct BehaviorSettings {
206206
/// Maximum number of keywords allowed for one user.
207+
#[serde(alias = "maxkeywords")]
207208
pub(crate) max_keywords: u32,
208209

209210
/// Duration to wait for activity before sending a notification.
@@ -222,11 +223,13 @@ pub(crate) struct BotSettings {
222223
/// Bot token to log into Discord with.
223224
pub(crate) token: String,
224225
/// ID of the bot's application.
226+
#[serde(alias = "applicationid")]
225227
pub(crate) application_id: u64,
226228
/// Whether this bot is private or not.
227229
///
228230
/// Controls whether the `about` command outputs an invite link.
229231
pub(crate) private: bool,
232+
#[serde(alias = "testguild")]
230233
pub(crate) test_guild: Option<GuildId>,
231234
}
232235

@@ -244,6 +247,7 @@ pub(crate) struct LoggingSettings {
244247
///
245248
/// See [`TraceIdRatioBased`](opentelemetry::sdk::trace::Sampler::TraceIdRatioBased).
246249
#[cfg(feature = "monitoring")]
250+
#[serde(alias = "sampleratio")]
247251
pub(crate) sample_ratio: f64,
248252

249253
/// Global level that log messages should be filtered to.

0 commit comments

Comments
 (0)