Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AIPentest CyberStrikeAI config Load

From Leeroopedia
Knowledge Sources
Domains Configuration
Last Updated 2026-10-19 04:10 GMT

Overview

Concrete tool for loading and normalizing CyberStrikeAI configuration provided by the internal/config package.

Description

Load reads a YAML config file, validates toolguard rules (refusing to start if they don't compile), applies defaults (session duration 12h, audit detail 8192 bytes), normalizes AI provider profiles and default AI channels, validates OpenAI output limits, merges tool definitions from a configured tools directory, expands environment variables in external MCP server entries, and loads role definitions from a roles directory. EnsureLocalConfig copies the example config on first start. EnsureMCPAuth bootstraps an MCP auth token if absent. LoadUpdateRepo resolves the update source repository URL. LoadRolesFromDir loads role YAML files.

Usage

  • Deployment step 2/3: called by cmd/server/main.go before app.New.
  • Self-update: LoadUpdateRepo resolves the source repo for update.Check/Apply.
  • First boot: EnsureLocalConfig + EnsureMCPAuth for zero-touch setup.

Code Reference

Source Location

  • Repository: CyberStrikeAI
  • File: internal/config/config.go
  • Lines: Load L1639, LoadUpdateRepo L1741, EnsureLocalConfig L1959, EnsureMCPAuth L2080, LoadRolesFromDir L2264

Signature

func Load(path string) (*Config, error)

func EnsureLocalConfig(path string) (EnsureLocalConfigResult, error)
func EnsureMCPAuth(path string, cfg *Config) error
func LoadUpdateRepo(configPath string) (string, error)
func LoadRolesFromDir(dir string) (map[string]RoleConfig, error)
func PrintBootstrapAdminPassword(password string)

Import

import "cyberstrike-ai/internal/config"

I/O Contract

Inputs

Name Type Required Description
path string Yes Config file path (e.g. config.yaml)

Outputs

Name Type Description
Load returns *Config, error Normalized config or parse/validate error

Usage Examples

Load and Boot

cfg, err := config.Load("config.yaml")
if err != nil { log.Fatal(err) }
if err := config.EnsureMCPAuth("config.yaml", cfg); err != nil { log.Fatal(err) }
a, err := app.New(cfg, logger, "config.yaml")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment