Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
build
*.pyc
*.egg-info
.idea
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
- Fixed bug with map crashing loading of nginx.conf.

## [1.2.0] - 2017-09-06
### Fixed
- Fixed several bugs involving parsing of messy files and brace locations (thanks @lelik9!)
Expand Down
16 changes: 16 additions & 0 deletions nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,15 @@ def __init__(self, value, *args):
self.name = 'geo'


class Map(Container):
"""Container for map configuration."""

def __init__(self, value, *args):
"""Initialize."""
super(Map, self).__init__(value, *args)
self.name = 'map'


class Key(object):
"""Represents a simple key/value object found in an nginx config."""

Expand Down Expand Up @@ -438,6 +447,13 @@ def loads(data, conf=True):
index += m.end()
continue

m = re.compile(r'^\s*map\s*(.*?\S+)\s*{', re.S).search(data[index:])
if m:
g = Map(m.group(1))
lopen.insert(0, g)
index += m.end()
continue

m = re.compile(r'^(\s*)#\s*(.*?)\n', re.S).search(data[index:])
if m:
c = Comment(m.group(2), inline='\n' not in m.group(1))
Expand Down