config

package
v0.0.0-...-b203053 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

config-utils.go - provide utility methods for handling and manipulating data provided in the AppConfig struct instance

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AuthTokenKey       string       `json:"authTokenKey"`
	Owner              string       `json:"owner"` // can be user or organization
	ExtractDir         string       `json:"extractDir"`
	TokenResultsConfig WriterConfig `json:"tokenResultsWriterConfig"`
	RepoResultsConfig  WriterConfig `json:"repoResultsWriterConfig"`
	SecretKeys         `json:"secretKeys"`
	DependencyScanConfig
	ScanConfig
	CloudConfig

	CurrentDep string
}

func Read

func Read(fileName string) (*AppConfig, error)

func (*AppConfig) GetLanguage

func (config *AppConfig) GetLanguage(lang string) *Language

Returns the Language object associated with the provided string

func (*AppConfig) GetLanguageExts

func (config *AppConfig) GetLanguageExts() []string

Gets a list of file extensions associated with each defined language in the config

Example Language Definition:

Language { Name: "HTML", Extension: ".html" }

func (*AppConfig) GetShortDepName

func (config *AppConfig) GetShortDepName() string

Gets the short relative value of a dependency

npm deps are generally split by a backslash. I.E. @angular/material

func (*AppConfig) ShouldIgnoreRepo

func (config *AppConfig) ShouldIgnoreRepo(repoName string) bool

Determines whether the repo value is in the ignore repos slice

func (*AppConfig) ToListOptions

func (config *AppConfig) ToListOptions() *github.ListOptions

Converts the PerPage ScanConfig value to a githubListOptions pointer

type CloudConfig

type CloudConfig struct {
	Region string `json:"region"`
	DBConfig
}

type Config

type Config interface {
	Read(fileName string) error
}

type DBConfig

type DBConfig struct {
	TableName string `json:"tableName"`
}

type DependencyScanConfig

type DependencyScanConfig struct {
	PackageFile   string     `json:"packageFile"`
	Languages     []Language `json:"languages"`
	Dependencies  []string   `json:"dependencies"`
	ReposToIgnore []string   `json:"reposToIgnore"`
	TeamsToIgnore `json:"teamsToIgnore"`
}

type DestinationType

type DestinationType string

Custom type for defining destinations

const (
	DefaultDestination DestinationType = "none"
	FileDestination    DestinationType = "file"
	TableDesitnation   DestinationType = "table"
)

Destination type enumeration

Where the results will be written to.

type Language

type Language struct {
	Name      string `json:"name"`
	Extension string `json:"extension"`
}

type ScanConfig

type ScanConfig struct {
	PerPage int `json:"perPage"`
}

type SecretKeys

type SecretKeys []string

SecretKeys

type TeamsToIgnore

type TeamsToIgnore []string

func (TeamsToIgnore) ShouldIgnoreTeam

func (teamsToIgnore TeamsToIgnore) ShouldIgnoreTeam(teamName string) bool

Determines whether the team value is in the ignore repos slice

type WriterConfig

type WriterConfig struct {
	// Out Directory, table name, etc...
	DestinationType    DestinationType `json:"destinationType"`
	Destination        string          `json:"destination"`
	UseBatchProcessing bool            `json:"useBatch"`
}

Configuration that is used to define a results writer

Jump to

Keyboard shortcuts

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