config

package
v0.0.0-...-82180e8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Signatures: signatures,
	Github:     github,
	Gitlab:     gitlab,
	Global:     global,
}

Functions

func PrintDebug

func PrintDebug(signatureVersion string) string

PrintDebug will print a debug header at the start of the session that displays specific setting

func SetConfig

func SetConfig(cmd *cobra.Command)

SetConfig will set the defaults, and load a config file and environment variables if they are present

Types

type Config

type Config struct {
	Github     Github     `mapstructure:"github" yaml:"github"`
	Local      Local      `mapstructure:"local" yaml:"local"`
	Signatures Signatures `mapstructure:"signatures" yaml:"signatures"`

	Gitlab Gitlab `mapstructure:"gitlab" yaml:"gitlab"`
	Global Global `mapstructure:"global" yaml:"global"`
}

func Load

func Load(scanType api.ScanType) (*Config, error)

TODO detect scanType automatically Load depends on cfg being initialized and populated, otherwise it will panic

type Github

type Github struct {
	APIToken            string   `mapstructure:"api-token" structs:"api-token" yaml:"api-token"`
	GithubURL           string   `mapstructure:"url" structs:"url" yaml:"url"`
	GithubEnterpriseURL string   `mapstructure:"enterprise-url" structs:"enterprise-url" yaml:"enterprise-url"`
	UserDirtyNames      []string `mapstructure:"users" structs:"users" yaml:"users,omitempty"`
	UserDirtyOrgs       []string `mapstructure:"orgs" structs:"orgs" yaml:"orgs,omitempty"`
	UserDirtyRepos      []string `mapstructure:"repos" structs:"repos" yaml:"repos,omitempty"`
	Enterprise          bool     `mapstructure:"enterprise"`
	// contains filtered or unexported fields
}

type Gitlab

type Gitlab struct {
	APIToken string   `mapstructure:"api-token" structs:"api-token" yaml:"api-token"`
	Targets  []string `mapstructure:"projects" structs:"projects" yaml:"projects,omitempty"`
	// contains filtered or unexported fields
}

type Global

type Global struct {
	AppVersion      string       `yaml:"-"`
	BindAddress     string       `mapstructure:"bind-address" structs:"bind-address" yaml:"bind-address"`
	ConfigFile      string       `mapstructure:"config-file" structs:"config-file" yaml:"-"`
	ScanType        api.ScanType `mapstructure:"scan-type" structs:"scan-type" yaml:"-"`
	SkippableExt    []string     `mapstructure:"ignore-extension" structs:"ignore-extension" yaml:"ignore-extension"`
	SkippablePath   []string     `mapstructure:"ignore-path" structs:"ignore-path" yaml:"ignore-path"`
	BindPort        int          `mapstructure:"bind-port" structs:"bind-port" yaml:"bind-port"`
	CommitDepth     int          `mapstructure:"commit-depth" structs:"commit-depth" yaml:"commit-depth"`
	ConfidenceLevel int          `mapstructure:"confidence-level" structs:"confidence-level" yaml:"confidence-level"`
	MaxFileSize     int64        `mapstructure:"max-file-size" structs:"max-file-size" yaml:"max-file-size"`
	Threads         int          `mapstructure:"num-threads" structs:"num-threads" yaml:"num-threads"`
	CSVOutput       bool         `mapstructure:"csv"`
	Debug           bool         `mapstructure:"debug"`
	ExpandOrgs      bool         `mapstructure:"expand-orgs" structs:"expand-orgs" yaml:"expand-orgs"`
	HideSecrets     bool         `mapstructure:"hide-secrets" structs:"hide-secrets" yaml:"hide-secrets"`
	InMemClone      bool         `mapstructure:"in-mem-clone" structs:"in-mem-clone" yaml:"in-mem-clone"`
	JSONOutput      bool         `mapstructure:"json" structs:"json"`
	ScanFork        bool         `mapstructure:"scan-forks" structs:"scan-forks" yaml:"scan-forks"`
	ScanTests       bool         `mapstructure:"scan-tests" structs:"scan-tests" yaml:"scan-tests"`
	Silent          bool         `mapstructure:"silent"`
	WebServer       bool         `mapstructure:"web-server" structs:"web-server" yaml:"web-server"`
	// contains filtered or unexported fields
}

type Local

type Local struct {
	Paths []string `mapstructure:"paths" yaml:",omitempty"`
	Repos []string `mapstructure:"repos" yaml:",omitempty"`
	// contains filtered or unexported fields
}

type Signatures

type Signatures struct {
	APIToken string `mapstructure:"api-token" structs:"api-token" yaml:"api-token"`
	File     string `mapstructure:"file"`
	Path     string `mapstructure:"path"`
	URL      string `mapstructure:"url"`
	UserRepo string `mapstructure:"user-repo" yaml:"user-repo"`
	Version  string `mapstructure:"version"`
	Test     bool   `mapstructure:"test"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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