config

package
v0.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Config loads and understand 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 {
	// LocationName is the file name or http server that the config was read from.
	// If this is "", it means that the location was unknown. This is the case if
	// the Prase() function is used directly.
	LocationName string
	Webserver    Webserver              `toml:"webserver"`
	Cache        map[string]interface{} `toml:"cache"`
	// Map of providers.
	Providers []map[string]interface{}
	Maps      []Map
}

A Config represents the 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 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) FindMap

func (cfg *Config) FindMap(name string) (Map, error)

FindMap will find the map with the provided name. If "" is used for the name, it will return the first Map in the config, if one is defined. If a map with the name is not found it will return ErrMapNotFound error.

func (*Config) Validate

func (c *Config) Validate() error

checks the config for issues

type ErrInvalidProviderLayerName

type ErrInvalidProviderLayerName struct {
	ProviderLayerName string
}

func (ErrInvalidProviderLayerName) Error

type ErrMapNotFound

type ErrMapNotFound struct {
	MapName string
}

func (ErrMapNotFound) Error

func (e ErrMapNotFound) 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        string     `toml:"name"`
	Attribution string     `toml:"attribution"`
	Bounds      []float64  `toml:"bounds"`
	Center      [3]float64 `toml:"center"`
	Layers      []MapLayer `toml:"layers"`
}

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          string      `toml:"name"`
	ProviderLayer string      `toml:"provider_layer"`
	MinZoom       int         `toml:"min_zoom"`
	MaxZoom       int         `toml:"max_zoom"`
	DefaultTags   interface{} `toml:"default_tags"`
}

type Webserver

type Webserver struct {
	HostName  string `toml:"hostname"`
	Port      string `toml:"port"`
	LogFile   string `toml:"log_file"`
	LogFormat string `toml:"log_format"`
}

Jump to

Keyboard shortcuts

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