specs

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright (C) 2021 Daniele Rondina <geaaru@sabayonlinux.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2021 Daniele Rondina <geaaru@sabayonlinux.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2021 Daniele Rondina <geaaru@sabayonlinux.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2021 Daniele Rondina <geaaru@sabayonlinux.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	WHIP_CONFIGNAME = "whip.yml"
	WHIP_ENV_PREFIX = "WHIP"
)

Variables

This section is empty.

Functions

func GenDefault

func GenDefault(viper *v.Viper)

Types

type CGeneral

type CGeneral struct {
	Debug bool `mapstructure:"debug,omitempty" json:"debug,omitempty" yaml:"debug,omitempty"`
}

func (*CGeneral) HasDebug

func (g *CGeneral) HasDebug() bool

type CLogging

type CLogging struct {
	// Path of the logfile
	Path string `mapstructure:"path,omitempty" json:"path,omitempty" yaml:"path,omitempty"`
	// Enable/Disable logging to file
	EnableLogFile bool `mapstructure:"enable_logfile,omitempty" json:"enable_logfile,omitempty" yaml:"enable_logfile,omitempty"`
	// Enable JSON format logging in file
	JsonFormat bool `mapstructure:"json_format,omitempty" json:"json_format,omitempty" yaml:"json_format,omitempty"`

	// Log level
	Level string `mapstructure:"level,omitempty" json:"level,omitempty" yaml:"level,omitempty"`

	// Enable emoji
	EnableEmoji bool `mapstructure:"enable_emoji,omitempty" json:"enable_emoji,omitempty" yaml:"enable_emoji,omitempty"`
	// Enable/Disable color in logging
	Color bool `mapstructure:"color,omitempty" json:"color,omitempty" yaml:"color,omitempty"`
}

type Config

type Config struct {
	Viper *v.Viper `yaml:"-" json:"-"`

	General CGeneral `mapstructure:"general" json:"general,omitempty" yaml:"general,omitempty"`
	Logging CLogging `mapstructure:"logging" json:"logging,omitempty" yaml:"logging,omitempty"`

	Loader   string   `mapstructure:"loader,omitempty" json:"loader,omitempty" yaml:"loader,omitempty"`
	SpecDirs []string `mapstructure:"specs_dirs,omitempty" json:"specs_dirs,omitempty" yaml:"specs_dirs,omitempty"`
}

func NewConfig

func NewConfig(viper *v.Viper) *Config

func (*Config) AddSpecsDirs

func (c *Config) AddSpecsDirs(dirs []string)

func (*Config) GetGeneral

func (c *Config) GetGeneral() *CGeneral

func (*Config) GetLogging

func (c *Config) GetLogging() *CLogging

func (*Config) Unmarshal

func (c *Config) Unmarshal() error

func (*Config) Yaml

func (c *Config) Yaml() ([]byte, error)

type Hook

type Hook struct {
	Remediate   string   `yaml:"remediate,omitempty" json:"remediate,omitempty"`
	Check       string   `yaml:"check,omitempty" json:"check,omitempty"`
	Description string   `yaml:"description,omitempty" json:"description,omitempty"`
	Keywords    []string `yaml:"keywords,omitempty" json:"keywords,omitempty"`
	Actions     []string `yaml:"actions,omitempty" json:"actions,omitempty"`
}

func (*Hook) GetActions

func (h *Hook) GetActions() []string

func (*Hook) GetCheck

func (h *Hook) GetCheck() string

func (*Hook) GetDescription

func (h *Hook) GetDescription() string

func (*Hook) GetKeywords

func (h *Hook) GetKeywords() []string

func (*Hook) GetRemediate

func (h *Hook) GetRemediate() string

type SpecFile

type SpecFile struct {
	File string `yaml:"-" json:"-"`

	Hooks      map[string]Hook `yaml:"hooks" json:"hooks"`
	Entrypoint []string        `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty"`
}

func NewSpecFileFromYaml

func NewSpecFileFromYaml(data []byte, f string) (*SpecFile, error)

func (*SpecFile) GetEntrypoint

func (f *SpecFile) GetEntrypoint() []string

func (*SpecFile) GetHook

func (f *SpecFile) GetHook(s string) (Hook, error)

Jump to

Keyboard shortcuts

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