Example #1
0
def test_get_userhome():
    print("Testing utils.get_userhome")
    from sregistry.utils import get_userhome

    home = get_userhome()
    assert home in os.environ.get("HOME")
Example #2
0
        sys.exit(1)

    if not silent and variable is not None:
        bot.verbose("%s found as %s" % (variable_key, variable))

    return variable


################################################################################
# SRegistry

#########################
# Global Settings
#########################

USERHOME = get_userhome()
DISABLE_CACHE = convert2boolean(getenv("SINGULARITY_DISABLE_CACHE", False))
DISABLE_DATABASE = convert2boolean(getenv("SREGISTRY_DISABLE", False))
DISABLE_SSL_CHECK = convert2boolean(getenv("SREGISTRY_HTTPS_NOVERIFY", False))

_secrets = os.path.join(USERHOME, ".sregistry")
SREGISTRY_CLIENT_SECRETS = getenv('SREGISTRY_CLIENT_SECRETS', _secrets)

# If the client secrets exist, use the default as first priority
_client = 'hub'
if os.path.exists(SREGISTRY_CLIENT_SECRETS):
    secrets = read_json(SREGISTRY_CLIENT_SECRETS)
    _client = secrets.get('SREGISTRY_CLIENT', 'hub')
SREGISTRY_CLIENT = getenv("SREGISTRY_CLIENT", _client)

#########################