Merge lp:~patrickas/ensoft-sextant/address-bind into lp:ensoft-sextant

Proposed by Patrick Stevens
Status: Merged
Approved by: Phil Connell
Approved revision: 21
Merged at revision: 19
Proposed branch: lp:~patrickas/ensoft-sextant/address-bind
Merge into: lp:ensoft-sextant
Diff against target: 74 lines (+15/-6)
3 files modified
etc/sextant.conf (+6/-2)
src/sextant/environment.py (+8/-3)
src/sextant/web/server.py (+1/-1)
To merge this branch: bzr merge lp:~patrickas/ensoft-sextant/address-bind
Reviewer Review Type Date Requested Status
Phil Connell Approve
Review via email: mp+233245@code.launchpad.net

Commit message

Add config file option SERVER_BIND to make Sextant Web bind only on a particular address. In particular, no longer binds on 0.0.0.0 by default, but to 127.0.0.1.

Description of the change

Add config file option SERVER_BIND to make Sextant Web bind only on a particular address. In particular, no longer binds on 0.0.0.0 by default, but to 127.0.0.1.

To post a comment you must log in.
Revision history for this message
Phil Connell (pconnell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'etc/sextant.conf'
2--- etc/sextant.conf 2014-09-01 14:46:48 +0000
3+++ etc/sextant.conf 2014-09-03 16:41:20 +0000
4@@ -1,8 +1,6 @@
5 [Neo4j]
6 # URL of the Neo4J server
7 #remote_neo4j = http://localhost:7474
8-# Port on which to serve Sextant Web
9-#port = 2905
10 # Number of calls incoming before we consider a function to be 'common'.
11 # Defaults to 10.
12 #common_function_calls = 10
13@@ -13,3 +11,9 @@
14 # Which username to use on the remote SSH server. Default, or empty, is your
15 # currently-logged-in username.
16 #ssh_username =
17+
18+[Web]
19+# Address to bind Sextant Web
20+server_bind = 127.0.0.1
21+# Port on which to serve Sextant Web
22+#port = 2905
23
24=== modified file 'src/sextant/environment.py'
25--- src/sextant/environment.py 2014-09-03 09:47:04 +0000
26+++ src/sextant/environment.py 2014-09-03 16:41:20 +0000
27@@ -10,7 +10,7 @@
28 """
29
30 __all__ = ("RESOURCES_DIR", "DEFAULT_CONFIG_FILE", "ENV_CONFIG_FILE",
31- "HOME_CONFIG_FILE", "load_config")
32+ "HOME_CONFIG_FILE", "SERVER_BIND", "load_config")
33
34 import os
35 import logging
36@@ -28,7 +28,7 @@
37 ENV_CONFIG_FILE = "SEXTANT_CONFIG" # name of the config-file env var to seek
38 # path to user-specific configuration file to seek
39 HOME_CONFIG_FILE = os.path.expanduser(os.path.join("~", ".sextant.conf"))
40-
41+SERVER_BIND = '' # which address Sextant Web will bind
42
43 def _find_folder(name):
44 """
45@@ -129,10 +129,15 @@
46 pass
47 else:
48 remote_neo4j = conf.get('Neo4j', 'remote_neo4j')
49- web_port = conf.getint('Neo4j', 'port')
50 common_def = conf.getint('Neo4j', 'common_function_calls')
51 use_ssh_tunnel = conf.getboolean('Neo4j', 'use_ssh_tunnel')
52 ssh_user = conf.get('Neo4j', 'ssh_username')
53+ try:
54+ global SERVER_BIND
55+ SERVER_BIND = conf.get('Web', 'server_bind')
56+ web_port = conf.getint('Web', 'port')
57+ except ConfigParser.NoSectionError:
58+ pass
59
60 return Config(remote_neo4j=remote_neo4j, web_port=web_port,
61 common_cutoff=common_def, use_ssh_tunnel=use_ssh_tunnel,
62
63=== modified file 'src/sextant/web/server.py'
64--- src/sextant/web/server.py 2014-08-26 13:47:55 +0000
65+++ src/sextant/web/server.py 2014-09-03 16:41:20 +0000
66@@ -305,7 +305,7 @@
67 root.putChild('output_graph.svg', SVGRenderer())
68
69 factory = Site(root)
70- reactor.listenTCP(port, factory)
71+ reactor.listenTCP(port, factory, interface=environment.SERVER_BIND)
72 reactor.run()
73
74 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches