config

package
v2.0.22 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HiroFileName is the hiro config
	HiroFileName = "hiro.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APISpec

type APISpec struct {
	Spec      string `json:"spec,omitempty"`
	Source    string `json:"source,omitempty"`
	Principal string `json:"principal,omitempty"`
	// Version is the semantic version for the function
	Version string `json:"version,omitempty"`
	// Models is the models path
	Models        string `json:"models"`
	GenerateStubs bool   `json:"operation_stubs"`
	BasePath      string `json:"base"`
	WithContext   bool   `json:"with_context"`
	AutoSync      bool   `json:"auto_sync"`
}

APISpec defines an API Specification

type Config

type Config struct {
	// Name is the project name
	Name string `json:"name"`

	// APIs is the project apis
	APIs map[string]*APISpec `json:"apis"`

	// Options is the Swagger Generation Options
	Options GenOptions `json:"options"`

	// Keys is the encryption keys
	Keys map[string]string `json:"keys"`

	// License is the license definition for the project
	License License `json:"license"`

	// Environment defines the global environment
	Environment map[string]map[string]string `json:"environment,omitempty"`
	// contains filtered or unexported fields
}

Config is the hiro project file definition

func Load

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

Load opens the config or returns a default one

func MustLoad

func MustLoad(configPath ...string) *Config

MustLoad loads the config or returns an empty on, panics on error

func New

func New(configPath ...string) *Config

New returns a new config with the specified path

func (*Config) AddSpec

func (c *Config) AddSpec(name string) *APISpec

AddSpec adds or returns an existing spec for the specificed name

func (*Config) Path

func (c *Config) Path() string

Path returns the path for the configuration file

func (*Config) Save

func (c *Config) Save() error

Save saves the config

func (*Config) SpecPath

func (c *Config) SpecPath(name string) string

SpecPath returns the path for the spec

type Function

type Function struct {
	Source string `json:"source,omitempty"`
	Proxy  string `json:"proxy,omitempty"`
	Env    string `json:"env,omitempty"`
}

Function defines a function settings

type GenOptions

type GenOptions struct {
	// Generate using non-pointer arrays i.e. []type vs []*type
	ScalarArrays bool `json:"scalar_arrays"`
}

GenOptions defines globa swagger generation options

type License

type License struct {
	Owner     string `json:"owner,omitempty"`
	Type      string `json:"type,omitempty"`
	Header    string `json:"header,omitempty"`
	Copyright string `json:"-"`
}

License defines the project license type

Jump to

Keyboard shortcuts

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