Skip to content

Commit 5650794

Browse files
author
J Beshir
committed
Add start of configuration rework branch, changes config file format.
1 parent dc3559b commit 5650794

File tree

5 files changed

+270
-12
lines changed

5 files changed

+270
-12
lines changed

LICENSE

+2
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1717
Though it is not required, we would appreciate public facing
1818
instances leaving a mention of the original author(s) and the
1919
project name and URL in the about dialog, thanks!
20+
21+
Note that the included YAML

bin/mkstatic.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ def main():
9292
copy(os.path.join("bin", "cleanpyc.py"), os.path.join(DEST, "cleanpyc.py"), nojoin=1)
9393

9494
copy("run.py", DEST)
95-
copy("config.py.example", DEST)
95+
copy("iris.conf.example", DEST)
9696

97-
if os.path.exists("config.py"):
98-
print "NOT copying current config.py!"
99-
#copy("config.py", DEST)
97+
if os.path.exists("iris.conf"):
98+
print "NOT copying current iris.conf!"
10099

101100
if __name__ == "__main__":
102101
main()
103-
102+

bin/pagegen.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import os, sys, pages, subprocess, re, optionsgen, config
1+
import os, sys, pages, subprocess, re
2+
import qwebirc.config as config
23

34
class HGException(Exception):
45
pass
@@ -53,18 +54,18 @@ def producehtml(name, debug):
5354
ui = pages.UIs[name]
5455
js = jslist(name, debug)
5556
css = csslist(name, debug, gen=True)
56-
csshtml = "\n".join(" <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.STATIC_BASE_URL, x) for x in css)
57-
jshtml = "\n".join(" <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.STATIC_BASE_URL, x) for x in js)
57+
csshtml = "\n".join(" <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.tunefront["static_base_url"], x) for x in css)
58+
jshtml = "\n".join(" <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.tunefront["static_base_url"], x) for x in js)
5859

5960
div = ui.get("div", "")
60-
customcss = "\n".join(" <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.STATIC_BASE_URL, x) for x in ui.get("customcss", []))
61-
customjs = "\n".join(" <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.STATIC_BASE_URL, x) for x in ui.get("customjs", []))
61+
customcss = "\n".join(" <link rel=\"stylesheet\" href=\"%s%s\" type=\"text/css\"/>" % (config.tunefront["static_base_url"], x) for x in ui.get("customcss", []))
62+
customjs = "\n".join(" <script type=\"text/javascript\" src=\"%s%s\"></script>" % (config.tunefront["static_base_url"], x) for x in ui.get("customjs", []))
6263

6364
return """%s
6465
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6566
<head>
6667
<base />
67-
<title>%s (qwebirc)</title>
68+
<title>%s (Iris)</title>
6869
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
6970
<link rel="shortcut icon" type="image/png" href="%simages/favicon.png"/>
7071
%s%s
@@ -82,7 +83,7 @@ def producehtml(name, debug):
8283
</div>
8384
</body>
8485
</html>
85-
""" % (ui["doctype"], config.APP_TITLE, config.STATIC_BASE_URL, csshtml, customcss, jshtml, customjs, ui["class"], optionsgen.get_options(), div)
86+
""" % (ui["doctype"], config.ui["app_title"], config.tunefront["static_base_url"], csshtml, customcss, jshtml, customjs, ui["class"], config.js_config(), div)
8687

8788
def main(outputdir=".", produce_debug=True):
8889
p = os.path.join(outputdir, "static")

iris.conf.example

+237
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Iris configuration file
2+
#
3+
# This is in a format similar to ini files and similar.
4+
# Lines beginning with # are comments.
5+
#
6+
# Note that some changes to this configuration file require re-running
7+
# compile.py, others require restarting Iris, and some may require both.
8+
# Individual blocks are labeled with their requirements.
9+
#
10+
# Be warned that some settings are, via inclusion in the frontend, exposed
11+
# to users. These blocks are labeled.
12+
13+
# EXECUTION OPTIONS
14+
# These options set parameters to Iris startup and execution.
15+
# They require a backend restart to change.
16+
[execution]
17+
18+
# ARGS: These arguments will be used as if Iris was run directly with
19+
# with them, see run.py --help for a list of options.
20+
# Set empty for no options.
21+
args: -n -p 3989
22+
23+
# SYSLOG ADDR: Used in conjunction with util/syslog.py and -s option.
24+
# This option specifies the address that syslog datagrams will be sent
25+
# to. If enabled, set syslog_port, too.
26+
# syslog_addr: 127.0.0.1
27+
28+
# SYSLOG PORT: Sets the port to send syslog datagrams to, if
29+
# syslog_addr is set
30+
# syslog_port: 514
31+
32+
33+
34+
# BACKEND IRC CONNECTION OPTIONS
35+
# These options provide the needed information for the backend to connect to
36+
# the IRC server and perform registration.
37+
# They require a backend restart to change.
38+
[irc]
39+
40+
# SERVER: Hostname (or IP address) of IRC server to connect to.
41+
server: irc.myserver.com
42+
43+
# PORT: Port of IRC server to connect to.
44+
port: 6667
45+
46+
# REALNAME: The realname field for clients connecting through the
47+
# webclient.
48+
realname: http://moo.com/
49+
50+
# IDENT: Type of ident to use on IRC, possible values include:
51+
# - string: Use a fixed string specified by ident_string.
52+
# - identhex: Use the user's IP, in hexadecimal.
53+
# - nickname: Use the user's specified nickname.
54+
ident: string
55+
56+
# IDENT STRING: A fixed string to use as an ident on IRC.
57+
# See ident setting documentation.
58+
ident_string: webchat
59+
60+
# WEBIRC MODE: This option controls how the IP/hostname of the
61+
# connecting browser will be sent to IRC. If set, the IRC server may
62+
# be able to transparently display users of Iris as from their
63+
# original hosts, rather than as coming from the webclient's IP.
64+
# Possible values include:
65+
# - webirc: Use WEBIRC type blocks, with a server configuration of
66+
# the following style:
67+
#
68+
# cgiirc: {
69+
# type webirc;
70+
# hostname <qwebirc's ip address>;
71+
# password <password>;
72+
# };
73+
#
74+
# You must set webirc_password to be the same as <password>.
75+
#
76+
# - cgiirc: Use an old style CGIIRC command, set cgiirc_string to be
77+
# the command used to set the ip/hostname, and set webirc_password
78+
# to be the password used in the server's configuration file.
79+
#
80+
# Set empty: Disables WEBIRC.
81+
# Sends the IP and hostname in the realname field, overriding
82+
# the REALNAME option.
83+
webirc_mode:
84+
85+
# WEBIRC PASSWORD: Used for webirc modes webirc and cgiirc, see
86+
# webirc_mode option documentation.
87+
webirc_password: fish
88+
89+
# CGIIRC STRING: Command sent to IRC server in for cgiirc webirc
90+
# mode. See webirc_mode option documentation.
91+
cgiirc_string: CGIIRC
92+
93+
94+
95+
# FRONTEND UI OPTIONS
96+
# These alter the behaviour or appearance of the JavaScript UI.
97+
# These are exposed to users.
98+
# These require a rerun of compile.py to change.
99+
[ui]
100+
101+
# BASE URL: URL that this qwebirc instance will be available at, add
102+
# the port number if your instance runs on a port other than 80.
103+
base_url: http://foo.foo.org/
104+
105+
# NETWORK NAME: The name of your IRC network, displayed throughout the
106+
# application.
107+
network_name: FooNet
108+
109+
# APP TITLE: The title of the application in the web browser.
110+
# The title of the application in the web browser.
111+
app_title: %(network_name)s Web IRC
112+
113+
114+
115+
116+
117+
# ATHEME ENGINE OPTIONS
118+
# These options control integration with Atheme by the Atheme engine backend.
119+
# They require a backend restart to change.
120+
[athemeengine]
121+
122+
# XMLRPC PATH: Address of your Atheme directory instance. Allows
123+
# authentication to NickServ ala SASL AUTHCOOKIE.
124+
# If you don't have an Atheme directory instance, leave unset.
125+
xmlrpc_path: http://127.0.0.1:8080/xmlrpc
126+
127+
128+
129+
# FEEDBACK ENGINE OPTIONS
130+
# These options control the feedback system backend, which allows users to
131+
# send feedback directly from Iris, when forwards it via email.
132+
# They require a backend restart to change.
133+
[feedback]
134+
135+
# FEEDBACK FROM: E-mail address that feedback will originate from.
136+
137+
138+
# FEEDBACK TO: E-mail address that feedback will be sent to.
139+
140+
141+
# SMTP HOST: Hostname/IP address of SMTP server feedback will be sent
142+
# through.
143+
smtp_host: 127.0.0.1
144+
145+
# SMTP PORT: Port of SMTP server feedback will be sent through.
146+
smtp_port: 25
147+
148+
149+
150+
# ADMIN ENGINE OPTIONS
151+
# These options control the admin engine backend.
152+
# They require a backend restart to change.
153+
[adminengine]
154+
155+
# HOSTS: Comma-separated list of IP addresses to allow onto the admin
156+
# engine at http://instance/adminengine
157+
hosts: 127.0.0.1
158+
159+
160+
161+
# PROXY OPTIONS
162+
# These options manage trust of proxies between the users and the backend.
163+
# They require a backend restart to change.
164+
[proxy]
165+
166+
# FORWARDED FOR HEADER: If you're using a proxy that passes through a
167+
# forwarded-for header, set this option to the header name, also set
168+
# forwarded_for_ips. Leave empty otherwise.
169+
forwarded_for_header:
170+
171+
# FORWARDED FOR IPS: This option specifies the IP addresses that
172+
# forwarded-for headers will be accepted from as a comma-separated
173+
# list. Ignored if forwarded_for_header is empty.
174+
forwarded_for_ips: 127.0.0.1
175+
176+
177+
178+
# BACKEND TUNEABLE VALUES
179+
# You probably don't want to fiddle with these unless you really know what
180+
# you're doing...
181+
# These options require a backend restart to change.
182+
[tuneback]
183+
184+
# UPDATE FREQ: Maximum rate (in seconds) at which updates will be
185+
# propagated to clients
186+
update_freq: 0.5
187+
188+
# MAXBUFLEN: Maximum client AJAX recieve buffer size (in bytes), if
189+
# this buffer size is exceeded then the client will be disconnected.
190+
# This value should match the client sendq size in your ircd's
191+
# configuration.
192+
maxbuflen: 100000
193+
194+
# MAXSUBSCRIPTIONS: Maximum amount of 'subscriptions' to a specific
195+
# AJAX channel, i.e. an IRC connection. In theory with a value greater
196+
# than one you can connect more than one web IRC client to the same
197+
# IRC connection, ala irssi-proxy.
198+
maxsubscriptions: 1
199+
200+
# MAXLINELEN: If the client sends a line greater than maxlinelen (in
201+
# bytes) then they will be disconnected.
202+
# Note that IRC normally silently drops messages >=512 bytes.
203+
maxlinelen: 600
204+
205+
# DNS TIMEOUT: DNS requests that do not respond within dns_timeout
206+
# seconds will be cancelled.
207+
dns_timeout: 5
208+
209+
# HTTP AJAX REQUEST TIMEOUT: Connections made to the AJAX engine are
210+
# closed after this many seconds. Note that this value is intimately
211+
# linked with the client AJAX code at this time, changing it will
212+
# result in bad things happening.
213+
http_ajax_request_timeout: 30
214+
215+
# HTTP REQUEST TIMEOUT: Connections made to everything but the AJAX
216+
# engine will be closed after this many seconds, including connections
217+
# that haven't started/completed an HTTP request.
218+
http_request_timeout: 5
219+
220+
221+
222+
# FRONTEND TUNABLE SETTINGS
223+
# You probably don't want to fiddle with these unless you really know what
224+
# you're doing...
225+
# These options are exposed to the users.
226+
# They require a rerun of compile.py to change.
227+
[tunefront]
228+
229+
# STATIC BASE URL: This value is used to build the URL for all static
230+
# HTTP requests. You'd find this useful if you're running multiple
231+
# Iris instances on the same host.
232+
static_base_url:
233+
234+
# DYNAMIC BASE URL:This value is used to build the URL for all dynamic
235+
# HTTP requests. You'd find this useful if you're running multiple
236+
# Iris instances on the same host.
237+
dynamic_base_url:

qwebirc/config.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import ConfigParser
2+
import qwebirc.util.qjson as json
3+
4+
def load_config():
5+
config = ConfigParser.SafeConfigParser()
6+
config.read('iris.conf')
7+
for section in config.sections():
8+
globals()[section] = {}
9+
for k, v in config.items(section):
10+
globals()[section][k] = v
11+
12+
def js_config():
13+
options = {
14+
'ui': ui,
15+
'tunefront': tunefront,
16+
}
17+
return json.dumps(options)
18+
19+
load_config()

0 commit comments

Comments
 (0)