Skip to content

Commit

Permalink
refactor(config): split utils (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreDemailly authored Nov 9, 2023
1 parent 400079b commit 158f082
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 366 deletions.
1 change: 1 addition & 0 deletions src/agent/test/FT/selfMonitoring.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe("Self-monitoring", () => {
before(async() => {
process.env.GRAFANA_API_TOKEN = "toto";
setGlobalDispatcher(kMockAgent);
kMockAgent.disableNetConnect();

const pool = kMockAgent.get("https://discord.com");
pool.intercept({
Expand Down
8 changes: 4 additions & 4 deletions src/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ export async function initConfig(configPath: string | URL): Promise<SigynInitial
config.templates![key] = utils.extendsTemplates(template, config);
}

const rules = await utils.initializeRules(config);
const rules = await utils.rules.initialize(config);
validateConfig(config);

config.rules = utils.applyRulesLogQLVariables({ ...config, rules });
config.rules = utils.rules.applyLogQLVariables({ ...config, rules });

const compositeRules = utils.initializeCompositeRules(config);
const compositeRules = utils.compositeRules.initialize(config);

initializedConfig = utils.applyDefaultValues({
...config,
compositeRules: utils.handleCompositeRulesTemplates(config, compositeRules)
compositeRules: utils.compositeRules.handleTemplates(config, compositeRules)
});

return initializedConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export interface SigynInitializedCompositeRule {
notifCount: number;
ruleCountThreshold?: number;
interval: string;
template: string | SigynInitializedTemplate;
template: SigynInitializedTemplate;
notifiers: string[];
throttle?: {
count: number;
Expand Down
340 changes: 0 additions & 340 deletions src/config/src/utils.ts

This file was deleted.

Loading

0 comments on commit 158f082

Please sign in to comment.