[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Excluding tor config options if they match default
commit 0c0a54387a2c6f562b65d15820a8753f244c9b7a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Jul 9 18:14:46 2011 -0700
Excluding tor config options if they match default
When the wizard is generating a torrc it's now excluding options if they match
the defaults. This'll take some more work to get right.
---
src/cli/wizard.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/cli/wizard.py b/src/cli/wizard.py
index e2419e8..cf544a5 100644
--- a/src/cli/wizard.py
+++ b/src/cli/wizard.py
@@ -75,6 +75,10 @@ MSG_COLOR = "green"
OPTION_COLOR = "yellow"
DISABLED_COLOR = "cyan"
+# tor's defaults for config options, used to filter unneeded options
+TOR_DEFAULTS = {Options.BANDWIDTH: "5 MB",
+ Options.REUSE: "10 minutes"}
+
CONFIG = {"wizard.message.role": "",
"wizard.message.relay": "",
"wizard.message.exit": "",
@@ -551,6 +555,11 @@ def getTorrc(relayType, config):
templateOptions["BRIDGES"] = "\n".join(bridgeLines)
+ # removes options if they match the tor defaults
+ for opt in TOR_DEFAULTS:
+ if templateOptions[opt.upper()] == TOR_DEFAULTS[opt]:
+ del templateOptions[opt.upper()]
+
return torConfig.renderTorrc(template, templateOptions)
def showConfirmationDialog(torrcContents, torrcLocation):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits