Example #1
0
import os
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)

_apphome = os.environ.get('METRILYX_HOME')
if _apphome == None:
    print " * Warning: METRILYX_HOME environment variable not set!"
    _apphome = os.path.dirname(os.path.dirname(_abspath))

CONFIG_FILE = os.path.join(_apphome, "etc/metrilyx/metrilyx.conf")
if not os.path.exists(CONFIG_FILE):
    raise RuntimeError("Configuration file not found: %s!" % (CONFIG_FILE))

config = jsonFromFile(CONFIG_FILE)

if config.has_key("error"):
    raise RuntimeError("Configuration error: %s" % (str(config)))

if not config.has_key("static_path"):
    config["static_path"] = os.path.join(os.path.dirname(_apphome), "www")

if not config.has_key("schema_path"):
    config["schema_path"] = os.path.join(_apphome, "etc/metrilyx/schemas")

if not config['annotations']['dataprovider'].has_key('default_mapping'):
    config['annotations']['dataprovider']['default_mapping'] = os.path.join(
        _apphome, "etc/metrilyx/ess-default-mappings.json")

default_mapping = jsonFromFile(
    config['annotations']['dataprovider']['default_mapping'])
Example #2
0
import os
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)
_apphome = os.path.dirname(os.path.dirname(_abspath))

CONFIG_FILE = os.path.join(_apphome, "etc/metrilyx/metrilyx.conf")
config = jsonFromFile(CONFIG_FILE)

config["static_path"] = os.path.join(os.path.dirname(_abspath), "static")
config["schema_path"] = os.path.join(_apphome, "schemas")
Example #3
0
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)

_apphome = os.environ.get('METRILYX_HOME')
if _apphome == None:
    print " * Warning: METRILYX_HOME environment variable not set!"
    _apphome = os.path.dirname(os.path.dirname(_abspath))

_appversion = open(os.path.join(_apphome, "VERSION")).read()

CONFIG_FILE = os.path.join(_apphome, "etc/metrilyx/metrilyx.conf")
if not os.path.exists(CONFIG_FILE):
    raise RuntimeError("Configuration file not found: %s!" % (CONFIG_FILE))

config = jsonFromFile(CONFIG_FILE)

if config.has_key("error"):
    raise RuntimeError("Configuration error: %s" % (str(config)))

# Check version
if not config.has_key("version"):
    config["version"] = _appversion
elif config["version"] != _appversion:
    raise RuntimeError(
        "Configuration version not supported: Config version: %s; App version: %s;"
        % (config["version"], _appversion))

if not config.has_key("static_path"):
    config["static_path"] = os.path.join(os.path.dirname(_apphome), "www")
import os 
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)

CONFIG_FILE = os.path.join(os.path.dirname(os.path.dirname(_abspath)), "etc/metrilyx/metrilyx.conf")
config = jsonFromFile(CONFIG_FILE)
## Not exposed to the user.
config["static_path"] = os.path.join(os.path.dirname(_abspath), "static")
config["schema_path"] = os.path.join(os.path.dirname(os.path.dirname(_abspath)), "schemas")

if not config.has_key("model_path"):
	config["model_path"] = os.path.join(os.path.dirname(os.path.dirname(_abspath)), "pagemodels")

#from pprint import pprint
#print CONFIG_FILE
#pprint(config)
Example #5
0
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)

_apphome = os.environ.get('METRILYX_HOME')
if _apphome == None:
	print " * Warning: METRILYX_HOME environment variable not set!"
	_apphome = os.path.dirname(os.path.dirname(_abspath))

_appversion = open(os.path.join(_apphome, "VERSION")).read()

CONFIG_FILE = os.path.join(_apphome, "etc/metrilyx/metrilyx.conf")
if not os.path.exists(CONFIG_FILE):
	raise RuntimeError("Configuration file not found: %s!" %(CONFIG_FILE))

config = jsonFromFile(CONFIG_FILE)

if config.has_key("error"):
	raise RuntimeError("Configuration error: %s" %(str(config)))

# Check version
if not config.has_key("version"):
    config["version"] = _appversion
elif config["version"] != _appversion:
    raise RuntimeError("Configuration version not supported: Config version: %s; App version: %s;" 
        % (config["version"], _appversion))


if not config.has_key("static_path"):
	config["static_path"] = os.path.join(os.path.dirname(_apphome), "www")
import os
from datastores import jsonFromFile

_abspath = os.path.abspath(__file__)

_apphome = os.environ.get('METRILYX_HOME')
if _apphome == None:
	print " * Warning: METRILYX_HOME environment variable not set!"
	_apphome = os.path.dirname(os.path.dirname(_abspath))

CONFIG_FILE = os.path.join(_apphome, "etc/metrilyx/metrilyx.conf")
if not os.path.exists(CONFIG_FILE):
	raise RuntimeError("Configuration file not found: %s!" %(CONFIG_FILE))

config = jsonFromFile(CONFIG_FILE)

if config.has_key("error"):
	raise RuntimeError("Configuration error: %s" %(str(config)))

if not config.has_key("static_path"):
	config["static_path"] = os.path.join(os.path.dirname(_apphome), "www")

if not config.has_key("schema_path"):
	config["schema_path"] = os.path.join(_apphome, "etc/metrilyx/schemas")

if not config['annotations']['dataprovider'].has_key('default_mapping'):
    config['annotations']['dataprovider']['default_mapping'] = os.path.join(
                            _apphome, "etc/metrilyx/ess-default-mappings.json")

default_mapping = jsonFromFile(config['annotations']['dataprovider']['default_mapping'])