Skip to content

Commit

Permalink
Merge branch 'v0.6.0' into issue-107
Browse files Browse the repository at this point in the history
  • Loading branch information
ARolek committed Jan 4, 2018
2 parents 7fe0366 + 76cd60b commit bc31360
Show file tree
Hide file tree
Showing 26 changed files with 415 additions and 182 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ go:
env:
global:
- RUN_POSTGIS_TESTS=yes
- PGUSER=postgres
- PGHOST="localhost"
- PGPORT=5432
- PGDATABASE="tegola"
- PGUSER="postgres"

services:
- postgresql
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.5.0 (2017-12-XX)
## 0.5.0 (2017-12-12)

- Added: Command line `cache seed` and `cache purge` commands (#64)
- Added: Support for Amazon S3 as a cache backend (#64)
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
MIT License

Copyright (c) 2016

Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Use "tegola [command] --help" for more information about a command.
2. Setup your config file and run. Tegola expects a `config.toml` to be in the same directory as the binary. You can set a different location for the `config.toml` using a command flag:

```
./tegola sever --config=/path/to/config.toml
./tegola serve --config=/path/to/config.toml
```

## Server Endpoints
Expand Down Expand Up @@ -119,7 +119,7 @@ database = "tegola" # postgis database name (required)
user = "tegola" # postgis database user (required)
password = "" # postgis database password (required)
srid = 3857 # The default srid for this provider. Defaults to WebMercator (3857) (optional)
max_connections = "50" # The max connections to maintain in the connection pool. Default is 100. (optional)
max_connections = 50 # The max connections to maintain in the connection pool. Default is 100. (optional)

[[providers.layers]]
name = "landuse" # will be encoded as the layer name in the tile
Expand All @@ -140,23 +140,15 @@ max_connections = "50" # The max connections to maintain in the connection
geometry_fieldname = "geom" # geom field. default is geom
id_fieldname = "gid" # geom id field. default is gid
# Custom sql to be used for this layer. Note: that the geometery field is wraped
# in a ST_AsBinary, as tegola only understand wkb.
sql = """
SELECT
gid,
ST_AsBinary(geom) AS geom
FROM
gis.rivers
WHERE
geom && !BBOX!
"""
# in a ST_AsBinary() and the use of the !BBOX! token
sql = "SELECT gid, ST_AsBinary(geom) AS geom FROM gis.rivers WHERE geom && !BBOX!"

# maps are made up of layers
[[maps]]
name = "zoning" # used in the URL to reference this map (/maps/:map_name)

[[maps.layers]]
provider_layer = "test_postgis.landuse" # must match a data provider layer
provider_layer = "test_postgis.landuse" # must match a data provider layer
min_zoom = 12 # minimum zoom level to include this layer
max_zoom = 16 # maximum zoom level to include this layer

Expand Down
4 changes: 4 additions & 0 deletions atlas/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ func (a *Atlas) AllMaps() []Map {
// SeedMapTile will generate a tile and persist it to the
// configured cache backend
func (a *Atlas) SeedMapTile(m Map, tile *tegola.Tile) error {
// confirm we have a tile
if tile == nil {
return ErrMissingTile
}
// confirm we have a cache backend
if a.cacher == nil {
return ErrMissingCache
Expand Down
1 change: 1 addition & 0 deletions atlas/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

var (
ErrMissingCache = errors.New("atlas: missing cache")
ErrMissingTile = errors.New("atlas: missing tile")
)

type ErrMapNotFound struct {
Expand Down
3 changes: 2 additions & 1 deletion ci/config_postgis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

set -ex

# fetch our test data and import it into Postgres
# fetch our test data and import it into Postgres.
# this command uses pg_restore and therefore leverages the environment variables document at https://www.postgresql.org/docs/9.2/static/libpq-envars.html
configure_postgis() {
local test_data="tegola.backup"
local test_data_url="https://s3-us-west-1.amazonaws.com/tegola-test-data/tegola-postgis-test-data.backup"
Expand Down
15 changes: 9 additions & 6 deletions internal/log/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ Logger Proxy API
Log messages below this level of severity will be ignored.
Default Log Level is INFO.

* log.Fatal(string, vals... interface{}):
* Each of the following also has a formatting string variety; i.e. Fatalf(), Errorf(), etc
which behaves the same as fmt.Printf() but outputs to the log instead of stdout.

* log.Fatal(vals... interface{}):
prevents the program from continuing
i.e. can't allocate additional memory

* log.Error(string, vals... interface{}):
* log.Error(vals... interface{}):
non-fatal, but prevents valid execution
i.e. can't connect to a database, complete a function call, open file, invalid format

* log.Warn(string, vals... interface{}):
* log.Warn(vals... interface{}):
looks unusual, but does not clearly prevent execution

* log.Info(string, vals... interface{}):
* log.Info(vals... interface{}):
Least severe message that a sysadmin would be interested in
i.e. server request logs

* log.Debug(string, vals... interface{}):
* log.Debug(vals... interface{}):
high level info for a developer. more than what a sysadmin would typically want

* log.Trace(string, vals... interface{}):
* log.Trace(vals... interface{}):
excruciating detail.

* log.SetOutput(io.Writer):
Expand Down
84 changes: 66 additions & 18 deletions internal/log/log.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package log

import (
"fmt"
"io"
"sync"
)

var TimestampRegex string = `\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}` // Ex: "2006-01-02 15:04:05"

type Interface interface {
// These all take args the same as calls to fmt.Printf()
Fatal(string, ...interface{})
Error(string, ...interface{})
Warn(string, ...interface{})
Info(string, ...interface{})
Debug(string, ...interface{})
Trace(string, ...interface{})
Fatal(...interface{})
Error(...interface{})
Warn(...interface{})
Info(...interface{})
Debug(...interface{})
Trace(...interface{})
SetOutput(io.Writer)
}

Expand Down Expand Up @@ -81,41 +84,86 @@ func SetLogLevel(lvl Level) {
}

// Output format should be: "timestamp•LOG_LEVEL•filename.go•linenumber•output"
func Fatal(format string, args ...interface{}) {
logger.Fatal(format, args...)
func Fatalf(format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
logger.Fatal(msg)
}

func Errorf(format string, args ...interface{}) {
if !IsError {
return
}
msg := fmt.Sprintf(format, args...)
logger.Error(msg)
}

func Warnf(format string, args ...interface{}) {
if !IsWarn {
return
}
msg := fmt.Sprintf(format, args...)
logger.Warn(msg)
}

func Infof(format string, args ...interface{}) {
if !IsInfo {
return
}
msg := fmt.Sprintf(format, args...)
logger.Info(msg)
}

func Debugf(format string, args ...interface{}) {
if !IsDebug {
return
}
msg := fmt.Sprintf(format, args...)
logger.Debug(msg)
}

func Tracef(format string, args ...interface{}) {
if !IsTrace {
return
}
msg := fmt.Sprintf(format, args...)
logger.Trace(msg)
}

func Fatal(args ...interface{}) {
logger.Fatal(args...)
}

func Error(format string, args ...interface{}) {
func Error(args ...interface{}) {
if !IsError {
return
}
logger.Error(format, args...)
logger.Error(args...)
}

func Warn(format string, args ...interface{}) {
func Warn(args ...interface{}) {
if !IsWarn {
return
}
logger.Warn(format, args...)
logger.Warn(args...)
}

func Info(format string, args ...interface{}) {
func Info(args ...interface{}) {
if !IsInfo {
return
}
logger.Info(format, args...)
logger.Info(args...)
}

func Debug(format string, args ...interface{}) {
func Debug(args ...interface{}) {
if !IsDebug {
return
}
logger.Debug(format, args...)
logger.Debug(args...)
}

func Trace(format string, args ...interface{}) {
func Trace(args ...interface{}) {
if !IsTrace {
return
}
logger.Trace(format, args...)
logger.Trace(args...)
}
Loading

0 comments on commit bc31360

Please sign in to comment.