config

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureProjectID added in v0.0.7

func EnsureProjectID(providedID, projectPath string) (string, error)

EnsureProjectID returns the provided project ID if it's not empty, otherwise loads it from the config. This is useful for maintaining backward compatibility where project_id can be explicitly provided or auto-derived from the configuration file.

func FindConfigFile added in v0.0.7

func FindConfigFile(startPath string) (string, error)

FindConfigFile searches for a gograph configuration file starting from the given path and traversing up the directory tree. It looks for both "gograph.yaml" (new format) and ".gograph.yaml" (legacy format).

func GetProjectIDFromPath added in v0.0.7

func GetProjectIDFromPath(path string) (string, error)

GetProjectIDFromPath loads the configuration from the given path and returns the project ID. It searches for config files starting from the given path and traversing up the directory tree.

func Save

func Save(cfg *Config, configPath string) error

Save saves the configuration to a file

Types

type AnalysisConfig

type AnalysisConfig struct {
	IgnoreDirs     []string `mapstructure:"ignore_dirs"`
	IgnoreFiles    []string `mapstructure:"ignore_files"`
	IncludeTests   bool     `mapstructure:"include_tests"`
	IncludeVendor  bool     `mapstructure:"include_vendor"`
	MaxConcurrency int      `mapstructure:"max_concurrency"`
}

AnalysisConfig represents analysis configuration

type Config

type Config struct {
	Project  ProjectConfig  `mapstructure:"project"`
	Neo4j    Neo4jConfig    `mapstructure:"neo4j"`
	Analysis AnalysisConfig `mapstructure:"analysis"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

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

Load loads configuration from a file

func LoadProjectConfig added in v0.0.7

func LoadProjectConfig(projectPath string) (*Config, error)

LoadProjectConfig loads configuration from a project path by searching for config files

func (*Config) ToProject

func (c *Config) ToProject(configPath string) *core.Project

ToProject converts the config to a core.Project

func (*Config) Validate added in v0.0.3

func (c *Config) Validate() error

Validate ensures the configuration is valid

type Neo4jConfig

type Neo4jConfig struct {
	URI      string `mapstructure:"uri"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Database string `mapstructure:"database"`
}

Neo4jConfig represents Neo4j connection configuration

type ProjectConfig

type ProjectConfig struct {
	ID       string `mapstructure:"id"`
	Name     string `mapstructure:"name"`
	RootPath string `mapstructure:"root_path"`
}

ProjectConfig represents project-specific configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL