config

package
v0.0.0-...-05a1c04 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config loads and understands the tegola config format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// the tile buffer to use
	TileBuffer *env.Int `toml:"tile_buffer"`
	// LocationName is the file name or http server that the config was read from.
	// If this is an empty string, it means that the location was unknown. This is the case if
	// the Parse() function is used directly.
	LocationName string
	Webserver    Webserver `toml:"webserver"`
	Cache        env.Dict  `toml:"cache"`
	// Map of providers.
	Providers    []env.Dict `toml:"providers"`
	MVTProviders []env.Dict `toml:"mvt_providers"`
	Maps         []Map      `toml:"maps"`
}

Config represents a tegola config file.

func Load

func Load(location string) (conf Config, err error)

Load will load and parse the config file from the given location.

func LoadAndValidate

func LoadAndValidate(filename string) (cfg Config, err error)

func Parse

func Parse(reader io.Reader, location string) (conf Config, err error)

Parse will parse the Tegola config file provided by the io.Reader.

func (*Config) ConfigureTileBuffers

func (c *Config) ConfigureTileBuffers()

ConfigTileBuffers handles setting the tile buffer for a Map

func (*Config) Validate

func (c *Config) Validate() error

checks the config for issues

type ErrInvalidHeader

type ErrInvalidHeader struct {
	Header string
}

func (ErrInvalidHeader) Error

func (e ErrInvalidHeader) Error() string

type ErrInvalidLayerZoom

type ErrInvalidLayerZoom struct {
	ProviderLayer string
	MinZoom       bool
	Zoom          int
	ZoomLimit     int
}

func (ErrInvalidLayerZoom) Error

func (e ErrInvalidLayerZoom) Error() string

type ErrInvalidProviderLayerName

type ErrInvalidProviderLayerName struct {
	ProviderLayerName string
}

func (ErrInvalidProviderLayerName) Error

type ErrInvalidURIPrefix

type ErrInvalidURIPrefix string

func (ErrInvalidURIPrefix) Error

func (e ErrInvalidURIPrefix) Error() string

type ErrMVTDiffereProviders

type ErrMVTDiffereProviders struct {
	Original string
	Current  string
}

func (ErrMVTDiffereProviders) Error

func (e ErrMVTDiffereProviders) Error() string

type ErrMapNotFound

type ErrMapNotFound struct {
	MapName string
}

func (ErrMapNotFound) Error

func (e ErrMapNotFound) Error() string

type ErrMissingEnvVar

type ErrMissingEnvVar struct {
	EnvVar string
}

func (ErrMissingEnvVar) Error

func (e ErrMissingEnvVar) Error() string

type ErrMixedProviders

type ErrMixedProviders struct {
	Map string
}

func (ErrMixedProviders) Error

func (e ErrMixedProviders) Error() string

type ErrOverlappingLayerZooms

type ErrOverlappingLayerZooms struct {
	ProviderLayer1 string
	ProviderLayer2 string
}

func (ErrOverlappingLayerZooms) Error

func (e ErrOverlappingLayerZooms) Error() string

type Map

type Map struct {
	Name        env.String   `toml:"name"`
	Attribution env.String   `toml:"attribution"`
	Bounds      []env.Float  `toml:"bounds"`
	Center      [3]env.Float `toml:"center"`
	Layers      []MapLayer   `toml:"layers"`
	TileBuffer  *env.Int     `toml:"tile_buffer"`
}

A Map represents a map in the Tegola Config file.

type MapLayer

type MapLayer struct {
	// Name is optional. If it's not defined the name of the ProviderLayer will be used.
	// Name can also be used to group multiple ProviderLayers under the same namespace.
	Name          env.String  `toml:"name"`
	ProviderLayer env.String  `toml:"provider_layer"`
	MinZoom       *env.Uint   `toml:"min_zoom"`
	MaxZoom       *env.Uint   `toml:"max_zoom"`
	DefaultTags   interface{} `toml:"default_tags"`
	// DontSimplify indicates wheather feature simplification should be applied.
	// We use a negative in the name so the default is to simplify
	DontSimplify env.Bool `toml:"dont_simplify"`
	// DontClip indicates wheather feature clipping should be applied.
	// We use a negative in the name so the default is to clipping
	DontClip env.Bool `toml:"dont_clip"`
}

func (MapLayer) GetName

func (ml MapLayer) GetName() (string, error)

GetName will return the user-defined Layer name from the config, or if not defined will return the name of the layer associated with the provider

func (MapLayer) ProviderLayerName

func (ml MapLayer) ProviderLayerName() (string, string, error)

ProviderLayerName returns the provider and layer names

type Webserver

type Webserver struct {
	HostName  env.String `toml:"hostname"`
	Port      env.String `toml:"port"`
	URIPrefix env.String `toml:"uri_prefix"`
	Headers   env.Dict   `toml:"headers"`
	SSLCert   env.String `toml:"ssl_cert"`
	SSLKey    env.String `toml:"ssl_key"`
}

Jump to

Keyboard shortcuts

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