How to use the pgctl.config.Config function in pgctl

To help you get started, we’ve selected a few pgctl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Yelp / pgctl / tests / unit / config.py View on Github external
from __future__ import absolute_import
from __future__ import unicode_literals

import os

import mock
import pytest
from testfixtures import ShouldRaise
from testfixtures import StringComparison as S

import pgctl.config as C


class example1(object):
    config = C.Config('example1')

    ini = '''\
[example1]
pgdir = mypgdir
pgconf = my.conf
services_list =
    first
    second
    third
'''

    yaml = '''\
pgdir: mypgdir
pgconf: my.conf
services:
    - first
github Yelp / pgctl / tests / spec / config.py View on Github external
def it_combines_all_the_configs(self, tmpdir):
        config = Config('my', {'default': 'default'})
        with setup(tmpdir):
            conf = config.combined()

        assert conf == {
            'etc': 'etc',
            'home': 'home',
            'app': 'app',
            'apps': ['1', '2', '3'],
            'app/a': 'app/a',
            'app/b': 'app/b',
            'environ': 'environ',
            'environs': ['1', '2', '3'],
        }
github Yelp / pgctl / tests / unit / config.py View on Github external
def it_has_parity_with_file_configs(self):
        config = C.Config(projectname='example1')
        assert config.from_environ(example1.environ) == example1.parsed
github Yelp / pgctl / tests / unit / config.py View on Github external
def it_can_parse(self):
        config = C.Config(projectname='my')
        assert config.from_environ({'MY_X': 2, 'MYY': 3, 'Z': 4}) == {'x': 2}
github Yelp / pgctl / tests / unit / config.py View on Github external
def it_can_parse_the_environ(self):
        config = C.Config(projectname='example1')
        with mock.patch.dict(os.environ, example1.environ):
            assert config.from_environ() == example1.parsed
github Yelp / pgctl / pgctl / config.py View on Github external
def main():
    from sys import argv
    for project in argv[1:]:
        print(json.dumps(
            Config(project).combined(),
            sort_keys=True,
            indent=4,
        ))
github Yelp / pgctl / pgctl / cli.py View on Github external
def main(argv=None):
    p = parser()
    args = p.parse_args(argv)
    config = Config('pgctl')
    config = config.combined(PGCTL_DEFAULTS, args)
    app = PgctlApp(config)

    return app()