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

Commit 21d3d3a

Browse files
committed
Rename the 'hack' configuration section to 'experimental'
1 parent bc04860 commit 21d3d3a

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

crates/cli/src/commands/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ impl Options {
140140
);
141141

142142
let site_config = SiteConfig {
143-
access_token_ttl: config.hack.access_token_ttl,
144-
compat_token_ttl: config.hack.compat_token_ttl,
143+
access_token_ttl: config.experimental.access_token_ttl,
144+
compat_token_ttl: config.experimental.compat_token_ttl,
145145
};
146146

147147
// Explicitly the config to properly zeroize secret keys

crates/config/src/sections/hack.rs renamed to crates/config/src/sections/experimental.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,27 @@ fn default_token_ttl() -> Duration {
2525
Duration::minutes(5)
2626
}
2727

28-
/// Configuration sections for miscellaneous options
28+
/// Configuration sections for experimental options
29+
///
30+
/// Do not change these options unless you know what you are doing.
2931
#[serde_as]
3032
#[derive(Clone, Debug, Deserialize, JsonSchema, Serialize)]
31-
pub struct HackConfig {
32-
/// Time-to-live of access tokens in seconds
33+
pub struct ExperimentalConfig {
34+
/// Time-to-live of access tokens in seconds. Defaults to 5 minutes.
3335
#[schemars(with = "u64", range(min = 60, max = 86400))]
3436
#[serde(default = "default_token_ttl")]
3537
#[serde_as(as = "serde_with::DurationSeconds<i64>")]
3638
pub access_token_ttl: Duration,
3739

38-
/// Time-to-live of compatibility access tokens in seconds
40+
/// Time-to-live of compatibility access tokens in seconds. Defaults to 5
41+
/// minutes.
3942
#[schemars(with = "u64", range(min = 60, max = 86400))]
4043
#[serde(default = "default_token_ttl")]
4144
#[serde_as(as = "serde_with::DurationSeconds<i64>")]
4245
pub compat_token_ttl: Duration,
4346
}
4447

45-
impl Default for HackConfig {
48+
impl Default for ExperimentalConfig {
4649
fn default() -> Self {
4750
Self {
4851
access_token_ttl: default_token_ttl(),
@@ -52,9 +55,9 @@ impl Default for HackConfig {
5255
}
5356

5457
#[async_trait]
55-
impl ConfigurationSection for HackConfig {
58+
impl ConfigurationSection for ExperimentalConfig {
5659
fn path() -> &'static str {
57-
"hack"
60+
"experimental"
5861
}
5962

6063
async fn generate<R>(_rng: R) -> anyhow::Result<Self>

crates/config/src/sections/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
2020
mod clients;
2121
mod database;
2222
mod email;
23-
mod hack;
23+
mod experimental;
2424
mod http;
2525
mod matrix;
2626
mod passwords;
@@ -34,7 +34,7 @@ pub use self::{
3434
clients::{ClientAuthMethodConfig, ClientConfig, ClientsConfig},
3535
database::{ConnectConfig as DatabaseConnectConfig, DatabaseConfig},
3636
email::{EmailConfig, EmailSmtpMode, EmailTransportConfig},
37-
hack::HackConfig,
37+
experimental::ExperimentalConfig,
3838
http::{
3939
BindConfig as HttpBindConfig, HttpConfig, ListenerConfig as HttpListenerConfig,
4040
Resource as HttpResource, TlsConfig as HttpTlsConfig, UnixOrTcp,
@@ -103,9 +103,9 @@ pub struct RootConfig {
103103
#[serde(default)]
104104
pub upstream_oauth2: UpstreamOAuth2Config,
105105

106-
/// Miscellaneous configuration options
106+
/// Experimental configuration options
107107
#[serde(default)]
108-
pub hack: HackConfig,
108+
pub experimental: ExperimentalConfig,
109109
}
110110

111111
#[async_trait]
@@ -130,7 +130,7 @@ impl ConfigurationSection for RootConfig {
130130
matrix: MatrixConfig::generate(&mut rng).await?,
131131
policy: PolicyConfig::generate(&mut rng).await?,
132132
upstream_oauth2: UpstreamOAuth2Config::generate(&mut rng).await?,
133-
hack: HackConfig::generate(&mut rng).await?,
133+
experimental: ExperimentalConfig::generate(&mut rng).await?,
134134
})
135135
}
136136

@@ -147,7 +147,7 @@ impl ConfigurationSection for RootConfig {
147147
matrix: MatrixConfig::test(),
148148
policy: PolicyConfig::test(),
149149
upstream_oauth2: UpstreamOAuth2Config::test(),
150-
hack: HackConfig::test(),
150+
experimental: ExperimentalConfig::test(),
151151
}
152152
}
153153
}
@@ -179,7 +179,7 @@ pub struct AppConfig {
179179
pub policy: PolicyConfig,
180180

181181
#[serde(default)]
182-
pub hack: HackConfig,
182+
pub experimental: ExperimentalConfig,
183183
}
184184

185185
#[async_trait]
@@ -201,7 +201,7 @@ impl ConfigurationSection for AppConfig {
201201
secrets: SecretsConfig::generate(&mut rng).await?,
202202
matrix: MatrixConfig::generate(&mut rng).await?,
203203
policy: PolicyConfig::generate(&mut rng).await?,
204-
hack: HackConfig::generate(&mut rng).await?,
204+
experimental: ExperimentalConfig::generate(&mut rng).await?,
205205
})
206206
}
207207

@@ -215,7 +215,7 @@ impl ConfigurationSection for AppConfig {
215215
secrets: SecretsConfig::test(),
216216
matrix: MatrixConfig::test(),
217217
policy: PolicyConfig::test(),
218-
hack: HackConfig::test(),
218+
experimental: ExperimentalConfig::test(),
219219
}
220220
}
221221
}

docs/config.schema.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
}
4646
]
4747
},
48-
"hack": {
49-
"description": "Miscellaneous configuration options",
48+
"experimental": {
49+
"description": "Experimental configuration options",
5050
"default": {
5151
"access_token_ttl": 300,
5252
"compat_token_ttl": 300
5353
},
5454
"allOf": [
5555
{
56-
"$ref": "#/definitions/HackConfig"
56+
"$ref": "#/definitions/ExperimentalConfig"
5757
}
5858
]
5959
},
@@ -724,20 +724,20 @@
724724
}
725725
]
726726
},
727-
"HackConfig": {
728-
"description": "Configuration sections for miscellaneous options",
727+
"ExperimentalConfig": {
728+
"description": "Configuration sections for experimental options\n\nDo not change these options unless you know what you are doing.",
729729
"type": "object",
730730
"properties": {
731731
"access_token_ttl": {
732-
"description": "Time-to-live of access tokens in seconds",
732+
"description": "Time-to-live of access tokens in seconds. Defaults to 5 minutes.",
733733
"default": 300,
734734
"type": "integer",
735735
"format": "uint64",
736736
"maximum": 86400.0,
737737
"minimum": 60.0
738738
},
739739
"compat_token_ttl": {
740-
"description": "Time-to-live of compatibility access tokens in seconds",
740+
"description": "Time-to-live of compatibility access tokens in seconds. Defaults to 5 minutes.",
741741
"default": 300,
742742
"type": "integer",
743743
"format": "uint64",

0 commit comments

Comments
 (0)