Skip to content

Commit 317f31c

Browse files
authored
Merge pull request #27 from tengu-team/stream-config
Add stream container
2 parents 8cdf9a8 + 5498fba commit 317f31c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nginx.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,15 @@ def __init__(self, value, *args):
355355
self.name = 'map'
356356

357357

358+
class Stream(Container):
359+
"""Container for stream sections in the main NGINX conf file."""
360+
361+
def __init__(self, *args):
362+
"""Initialize."""
363+
super(Stream, self).__init__('', *args)
364+
self.name = 'stream'
365+
366+
358367
class Key(object):
359368
"""Represents a simple key/value object found in an nginx config."""
360369

@@ -413,6 +422,13 @@ def loads(data, conf=True):
413422
index += m.end()
414423
continue
415424

425+
m = re.compile(r'^\s*stream\s*{', re.S).search(data[index:])
426+
if m:
427+
s = Stream()
428+
lopen.insert(0, s)
429+
index += m.end()
430+
continue
431+
416432
m = re.compile(r'^\s*server\s*{', re.S).search(data[index:])
417433
if m:
418434
s = Server()

0 commit comments

Comments
 (0)