config

package
v0.0.0-...-68e76a8 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config holds types and functions related to service configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Type  string `json:"type"`
	Limit int    `json:"limit"`
}

Cache holds tile cache configuration

type Config

type Config struct {
	Server   Server   `json:"server"`
	Cache    Cache    `json:"cache"`
	Logging  Logging  `json:"logging"`
	Postgres string   `json:"postgres"`
	Schema   string   `json:"schema"`
	Sources  []Source `json:"sources"`
	FontsDir string   `json:"fontsDir"`
	Path     string   `json:"-"`
}

Config is the parsed configuration file

Postgis Configuration

Postgres connection string can either be a URI or key/value pairs - for more details see:

http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING

Sample PostGIS

"postgres": "postgresql://user:password@/mvt"

func New

func New(path string) (*Config, error)

New will read config from the specified path

type Logging

type Logging struct {
	JSON  bool   `json:"json"`
	Level string `json:"level"`
}

Logging holds the logging setup for the server

type Server

type Server struct {
	Port int  `json:"port"`
	CORS bool `json:"cors"`
}

Server holds the web server configuration

type Source

type Source struct {
	Prefix string   `json:"prefix"`
	Name   string   `json:"name"`
	Layers []string `json:"layers"`
}

Source configures a set of layers to be displayed in a vector map. A source is composed of a name (which must be unique in the set of sources configured), a URI (which points to a datasource) and the set of layers to query.

Postgis Database:

{
    "name": "opmplc_su",
    "layers": [
        "namedplace",
        "building"
    ]
}

Jump to

Keyboard shortcuts

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