config

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 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 is the local file source for this api
	Spec string `json:"spec,omitempty"`

	// Source is the remote url for the api
	Source string `json:"source,omitempty"`

	// Principal is the data structure to use for authorization context
	Principal string `json:"principal,omitempty"`

	// Version is the semantic version for the function
	Version string `json:"version,omitempty"`

	// Models is the models import path
	Models string `json:"models"`

	// BasePath is the generated source base path
	BasePath string `json:"base"`

	// ServerPackage is the service base package
	ServerPackage string `json:"server_package"`

	// WithContext determine if the api methods will have a context.Context parameter
	WithContext bool `json:"with_context"`

	// AutoSync tells hiro to sync this api implicitly if sync is called with no parameters
	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"`

	// 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