feat: 修改从gitea上获取配置的逻辑
All checks were successful
Redis序列化结构检查 / redis-schema-check (push) Has been skipped

This commit is contained in:
2026-07-13 16:49:00 +08:00
parent 327546b127
commit 797f435ccd
7 changed files with 52 additions and 17 deletions

View File

@@ -38,4 +38,28 @@ class ConfigLoaderTest {
assertFalse(config.getNotify().isEnabled());
assertTrue(config.getBlockSeverities().contains("P2"));
}
@Test
void loadsWebhookUrlFromConfig(@org.junit.jupiter.api.io.TempDir Path tmp) throws IOException {
Path cfg = tmp.resolve("biz.yaml");
Files.write(cfg, ("notify:\n"
+ " webhook_url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test\n"
).getBytes(StandardCharsets.UTF_8));
CheckerConfig config = ConfigLoader.load(cfg);
assertEquals("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=test",
config.getNotify().getWebhookUrl());
}
@Test
void legacyWebhookEnvUrlStillWorks(@org.junit.jupiter.api.io.TempDir Path tmp) throws IOException {
Path cfg = tmp.resolve("biz.yaml");
Files.write(cfg, ("notify:\n"
+ " webhook_env: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=legacy\n"
).getBytes(StandardCharsets.UTF_8));
CheckerConfig config = ConfigLoader.load(cfg);
assertEquals("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=legacy",
config.getNotify().getWebhookUrl());
}
}