# $SnapHashLicense:
#
# SnapLogic - Open source data services
#
# Copyright (C) 2008, SnapLogic, Inc. All rights reserved.
#
# See http://www.snaplogic.org for more information about
# the SnapLogic project.
#
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LEGAL file
# at the top of the source tree.
#
# "SnapLogic" is a trademark of SnapLogic, Inc.
#
#
# $
# $Id: config.py 8600 2009-08-17 21:28:46Z pamor $
"""
Utilities related to server configuration
"""
def set_common_config(server_conf):
"""
Create and set the server's common config section
This will add the "common" section to a server configuration object, setting
several handy computed fields in it.
@param server_conf : Already-initialized server configuration
@type server_conf : snaplogic.common.config.snap_config.SnapConfig
"""
main_conf = server_conf.get_section("main")
if not "server_proxy_uri" in main_conf or not main_conf["server_proxy_uri"]:
main_process_uri = "http://" + main_conf["server_hostname"] + ":" + main_conf["server_port"]
else:
main_process_uri = main_conf["server_proxy_uri"]
server_conf.add_to_section('common', ('main_process_uri', main_process_uri))
server_conf.add_to_section('common', ('my_process_uri', main_process_uri))
server_conf.add_to_section('common', ('i_am_main_process', True))
|