[Nym3-commit] r350 - trunk/nymbaron/Server
laurent at conuropsis.org
laurent at conuropsis.org
Fri Oct 14 21:31:43 CEST 2005
Author: laurent
Date: 2005-10-14 21:31:42 +0200 (Fri, 14 Oct 2005)
New Revision: 350
Modified:
trunk/nymbaron/Server/Config.py
trunk/nymbaron/Server/Main.py
Log:
Load configuration from file in the server.
Modified: trunk/nymbaron/Server/Config.py
===================================================================
--- trunk/nymbaron/Server/Config.py 2005-10-14 19:27:10 UTC (rev 349)
+++ trunk/nymbaron/Server/Config.py 2005-10-14 19:31:42 UTC (rev 350)
@@ -26,6 +26,11 @@
import os
import ConfigParser
+SYSFILE = "/etc/nymbaron/nymbarond.conf"
+
+def userfile():
+ return os.environ['HOME'] + './nymbaronrc'
+
class Config:
def __init__(self, filename = None):
Modified: trunk/nymbaron/Server/Main.py
===================================================================
--- trunk/nymbaron/Server/Main.py 2005-10-14 19:27:10 UTC (rev 349)
+++ trunk/nymbaron/Server/Main.py 2005-10-14 19:31:42 UTC (rev 350)
@@ -40,8 +40,17 @@
lifeCycle = User.lifeCycle
"""The life cycle of a mail received by the server for a nym"""
-config = Config.Config()
-"""Global configuration file for the server"""
+# Try to load the configuration file.
+try:
+ import os
+ os.stat(Config.SYSFILE)
+ config = Config.Config(Config.SYSFILE)
+except:
+ try:
+ import os
+ os.stat(Config.userfile())
+ config = Config.Config(Config.userfile())
+ except: pass
def processIncoming(localpart, msg):
"""Process incoming mail from the MTA
More information about the Nym3-commit
mailing list