コード例 #1
0
#!/usr/bin/env python

# Parse and Print the configuration information seen for this site

import os, linecache, GnuPGInterface, time, commands, string
from Conf import ConfReader


config_dir = "/home/websites/www.distributedcity.com/conf/"

# Get the simple hostname, so we can use it to load the proper config file of this host
fd = os.popen("hostname -s")
data = fd.readline()
hostname = data[:-1]
fd.close()


# Set the configuration filename, complete with path
config_file_name = config_dir + "site_config.%s" % (hostname)

# Load and parse the configuration file using this handy ConfReader class
# the format of the file is the standard: name=value #comment
config = ConfReader(config_file_name)
config.parse()
# example: print config.host_root
print config.xmlrpc_host
コード例 #2
0
from Conf import ConfReader


# defines
error = 0

# Set the configuration filename, complete with path
config_file_name = '../conf/site_config.ini' 

"""
  Load and parse the configuration file using this handy ConfReader class
  the format of the file is the standard: name=value #comment
  use like this example: print config.host_root
  this will print the config parameter host_root
"""
config = ConfReader(config_file_name)
config.parse()


"""
 The file that contains the message sent to the user after the key has been generated.
 The format is:
 first line is the message subject
 second line onward is the body 
"""
success_message_filename = config.app_base + '/templates/general/key_gen_complete.txt'
log_file = config.machine_tmp_dir + '/logs/' + config.site_instance_name + '.gpg_activity.log'



# See if this command is already running, if so skip this process  if not, continue