diff options
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/src/config.rs b/src/config.rs index 271a340..7062187 100644 --- a/src/config.rs +++ b/src/config.rs | |||
| @@ -109,7 +109,7 @@ impl WhitelistEntry { | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | /// GRASP-05 Archive mode configuration | 111 | /// GRASP-05 Archive mode configuration |
| 112 | #[derive(Debug, Clone, Serialize, Deserialize)] | 112 | #[derive(Debug, Clone, Serialize, Deserialize, Default)] |
| 113 | pub struct ArchiveConfig { | 113 | pub struct ArchiveConfig { |
| 114 | /// Accept all repository announcements (no filtering) | 114 | /// Accept all repository announcements (no filtering) |
| 115 | /// | 115 | /// |
| @@ -146,6 +146,7 @@ impl ArchiveConfig { | |||
| 146 | /// Returns true if: | 146 | /// Returns true if: |
| 147 | /// - archive_all is true, OR | 147 | /// - archive_all is true, OR |
| 148 | /// - announcement matches any whitelist entry | 148 | /// - announcement matches any whitelist entry |
| 149 | /// | ||
| 149 | /// Note: grasp_services matching is handled via matches_grasp_services() | 150 | /// Note: grasp_services matching is handled via matches_grasp_services() |
| 150 | pub fn matches(&self, npub: &str, identifier: &str) -> bool { | 151 | pub fn matches(&self, npub: &str, identifier: &str) -> bool { |
| 151 | if self.archive_all { | 152 | if self.archive_all { |
| @@ -171,19 +172,8 @@ impl ArchiveConfig { | |||
| 171 | } | 172 | } |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 174 | impl Default for ArchiveConfig { | ||
| 175 | fn default() -> Self { | ||
| 176 | Self { | ||
| 177 | archive_all: false, | ||
| 178 | whitelist: Vec::new(), | ||
| 179 | grasp_services: Vec::new(), | ||
| 180 | read_only: false, | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | /// Repository whitelist configuration | 175 | /// Repository whitelist configuration |
| 186 | #[derive(Debug, Clone, Serialize, Deserialize)] | 176 | #[derive(Debug, Clone, Serialize, Deserialize, Default)] |
| 187 | pub struct RepositoryConfig { | 177 | pub struct RepositoryConfig { |
| 188 | /// Whitelist entries for selective repository acceptance | 178 | /// Whitelist entries for selective repository acceptance |
| 189 | /// | 179 | /// |
| @@ -207,16 +197,8 @@ impl RepositoryConfig { | |||
| 207 | } | 197 | } |
| 208 | } | 198 | } |
| 209 | 199 | ||
| 210 | impl Default for RepositoryConfig { | ||
| 211 | fn default() -> Self { | ||
| 212 | Self { | ||
| 213 | whitelist: Vec::new(), | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | |||
| 218 | /// Repository blacklist configuration | 200 | /// Repository blacklist configuration |
| 219 | #[derive(Debug, Clone, Serialize, Deserialize)] | 201 | #[derive(Debug, Clone, Serialize, Deserialize, Default)] |
| 220 | pub struct BlacklistConfig { | 202 | pub struct BlacklistConfig { |
| 221 | /// Blacklist entries for blocking specific repositories | 203 | /// Blacklist entries for blocking specific repositories |
| 222 | /// | 204 | /// |
| @@ -256,16 +238,8 @@ impl BlacklistConfig { | |||
| 256 | } | 238 | } |
| 257 | } | 239 | } |
| 258 | 240 | ||
| 259 | impl Default for BlacklistConfig { | ||
| 260 | fn default() -> Self { | ||
| 261 | Self { | ||
| 262 | blacklist: Vec::new(), | ||
| 263 | } | ||
| 264 | } | ||
| 265 | } | ||
| 266 | |||
| 267 | /// Event blacklist configuration for blocking events by author npub | 241 | /// Event blacklist configuration for blocking events by author npub |
| 268 | #[derive(Debug, Clone, Serialize, Deserialize)] | 242 | #[derive(Debug, Clone, Serialize, Deserialize, Default)] |
| 269 | pub struct EventBlacklistConfig { | 243 | pub struct EventBlacklistConfig { |
| 270 | /// Blacklisted npubs - events from these authors are rejected | 244 | /// Blacklisted npubs - events from these authors are rejected |
| 271 | /// | 245 | /// |
| @@ -292,14 +266,6 @@ impl EventBlacklistConfig { | |||
| 292 | } | 266 | } |
| 293 | } | 267 | } |
| 294 | 268 | ||
| 295 | impl Default for EventBlacklistConfig { | ||
| 296 | fn default() -> Self { | ||
| 297 | Self { | ||
| 298 | blacklisted_npubs: Vec::new(), | ||
| 299 | } | ||
| 300 | } | ||
| 301 | } | ||
| 302 | |||
| 303 | /// Database backend type for the relay | 269 | /// Database backend type for the relay |
| 304 | #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, ValueEnum)] | 270 | #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Default, ValueEnum)] |
| 305 | #[serde(rename_all = "lowercase")] | 271 | #[serde(rename_all = "lowercase")] |