config

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultCacheEnable     = false
	DefaultCacheSchemaFile = "schema.json"
	DefaultLogLevel        = "info"
	DefaultAuthHeader      = "Api-Key"
	DefaultAuthEnvVar      = "TUTONE_API_KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Header string `yaml:"header,omitempty"`
	EnvVar string `yaml:"api_key_env_var,omitempty"`
}

AuthConfig is the information necessary to authenticate to the NerdGraph API.

type CacheConfig

type CacheConfig struct {
	Enable     bool   `yaml:",omitempty"`
	SchemaFile string `yaml:"schema_file,omitempty"`
}

CacheConfig is the information necessary to store the NerdGraph schema in JSON.

type Config

type Config struct {
	LogLevel string `yaml:"log_level,omitempty"` // LogLevel sets the logging level

	Endpoint string      `yaml:"endpoint"`
	Auth     AuthConfig  `yaml:"auth"`
	Cache    CacheConfig `yaml:"cache"`

	Packages   []PackageConfig   `yaml:"packages,omitempty"`
	Generators []GeneratorConfig `yaml:"generators,omitempty"`
}

Config is the information keeper for generating go structs from type names.

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig will load a config file at the specified path or error.

type GeneratorConfig

type GeneratorConfig struct {
	Name            string `yaml:"name,omitempty"`
	DestinationFile string `yaml:"destination_file,omitempty"`
	TemplateDir     string `yaml:"template_dir,omitempty"`
	FileName        string `yaml:"fileName,omitempty"`
	TemplateName    string `yaml:"templateName,omitempty"`
}

GeneratorConfig is the information necessary to execute a generator.

type PackageConfig

type PackageConfig struct {
	Name  string       `yaml:"name,omitempty"`
	Path  string       `yaml:"path,omitempty"`
	Types []TypeConfig `yaml:"types,omitempty"`
	// Generators is a list of names that reference a generator in the Config struct.
	Generators []string `yaml:"generators,omitempty"`
	Imports    []string `yaml:"imports,omitempty"`
}

PackageConfig is the information about a single package, which types to include from the schema, and which generators to use for this package.

type TypeConfig

type TypeConfig struct {
	Name string `yaml:"name"`
	// FieldTypeOverride is the Golang type to override whatever the default detected type would be for a given field.
	FieldTypeOverride string `yaml:"field_type_override,omitempty"`
	// CreateAs is used when creating a new scalar type to determine which Go type to use.
	CreateAs string `yaml:"create_as,omitempty"`
	// SkipTypeCreate allows the user to skip creating a Scalar type.
	SkipTypeCreate bool `yaml:"skip_type_create,omitempty"`
}

TypeConfig is the information about which types to render and any data specific to handling of the type.

Jump to

Keyboard shortcuts

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