コード例 #1
0
    def get_context(self):
        conf = Config()
        conf.STATSD_HOST = ''
        ctx = Context(config=conf)
        ctx.request = RequestParameters()

        return ctx
コード例 #2
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                os.environ['SOME_CONFIGURATION'] = "test value"
                config = Config()

                Config.allow_environment_variables()

                return config.SOME_CONFIGURATION
コード例 #3
0
        def topic(self, callback):
            conf = Config()
            conf.define('TC_AWS_ALLOWED_BUCKETS', [], '')

            context = Context(config=conf)
            s3_loader.load(context, '/'.join([s3_bucket, IMAGE_PATH]),
                           callback)
コード例 #4
0
 def test_zopflipng_should_not_run_when_unavailable(self):
     conf = Config()
     conf.ZOPFLIPNG_PATH = '/tmp/asdf'
     ctx = Context(config=conf)
     optimizer = ZopflipngOptimizer(ctx)
     self.assertFalse(optimizer.runnable)
     self.assertFalse(optimizer.should_run('png', None))
コード例 #5
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                err = expect.error_to_happen(ConfigurationError)

                with err:
                    Config.load(fix('not-existent.conf'))

                return err
コード例 #6
0
    def get_context(self):
        conf = Config()
        conf.STATSD_HOST = ''
        ctx = Context(config=conf)
        ctx.request = RequestParameters()

        return ctx
コード例 #7
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                err = expect.error_to_happen(ConfigurationError)

                with err:
                    Config.load(fix('not-existent.conf'))

                return err
コード例 #8
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                os.environ['SOME_CONFIGURATION'] = "test value"
                config = Config()

                Config.allow_environment_variables()

                return config.SOME_CONFIGURATION
コード例 #9
0
    def get_context(self):
        conf = Config()
        conf.STATSD_HOST = ''
        ctx = Context(config=conf)
        ctx.request = RequestParameters()
        ctx.request.filters.append('auto')

        return ctx
コード例 #10
0
    def get_context(self):
        conf = Config()
        conf.STATSD_HOST = ''
        ctx = Context(config=conf)
        ctx.request = RequestParameters()
        ctx.request.filters.append('auto')

        return ctx
コード例 #11
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                config = Config.load(fix('sample.conf'))
                Config.allow_environment_variables()

                try:
                    os.environ['FOO'] = "baz"
                    return config.FOO
                finally:
                    del os.environ['FOO']
コード例 #12
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
            def topic(self):
                config = Config.load(fix('sample.conf'))
                Config.allow_environment_variables()

                try:
                    os.environ['FOO'] = "baz"
                    return config.FOO
                finally:
                    del os.environ['FOO']
コード例 #13
0
ファイル: presigning_loader_vows.py プロジェクト: pgr0ss/aws
        def topic(self):
            conn = boto.connect_s3()
            bucket = conn.create_bucket(s3_bucket)

            k = Key(bucket)
            k.key = IMAGE_PATH
            k.set_contents_from_string(IMAGE_BYTES)

            conf = Config()
            conf.define('S3_LOADER_BUCKET', s3_bucket, '')
            conf.define('S3_LOADER_ROOT_PATH', 'root_path', '')

            return Context(config=conf)
コード例 #14
0
ファイル: s3_loader_vows.py プロジェクト: aoqfonseca/aws
        def topic(self, callback):
            conn = boto.connect_s3()
            bucket = conn.create_bucket(s3_bucket)

            k = Key(bucket)
            k.key = '/'.join(['root_path', IMAGE_PATH])
            k.set_contents_from_string(IMAGE_BYTES)

            conf = Config()
            conf.define('TC_AWS_LOADER_BUCKET', s3_bucket, '')
            conf.define('TC_AWS_LOADER_ROOT_PATH', 'root_path', '')

            context = Context(config=conf)

            s3_loader.load(context, IMAGE_PATH, callback)
コード例 #15
0
ファイル: config.py プロジェクト: jdrew1303/githubsurvivor
    def load(self, config_path=None):
        """
        Load configuration from file. If no config path is given, several
        directories are searched for a file named 'githubsurvivor.conf': the
        current directory, followed by the current user's home directory, then
        finally /etc.
        """
        if not config_path:
            config_path = c.get_conf_file(self.DEFAULT_FILENAME, self.SEARCH_DIRS)

        if not config_path:
            raise Exception(
                'No configuration provided, and none found at any of %s' % \
                    ', '.join(path.join(d, self.DEFAULT_FILENAME) for d in self.SEARCH_DIRS))

        self._config = c.load(config_path or self._default_path())
コード例 #16
0
ファイル: config.py プロジェクト: dddaisuke/githubsurvivor
    def load(self, config_path=None):
        """
        Load configuration from file. If no config path is given, several
        directories are searched for a file named 'githubsurvivor.conf': the
        current directory, followed by the current user's home directory, then
        finally /etc.
        """
        if not config_path:
            config_path = c.get_conf_file(self.DEFAULT_FILENAME, self.SEARCH_DIRS)

        if not config_path:
            raise Exception(
                'No configuration provided, and none found at any of %s' % \
                    ', '.join(path.join(d, self.DEFAULT_FILENAME) for d in self.SEARCH_DIRS))

        self._config = c.load(config_path or self._default_path())
コード例 #17
0
    def test_can_validate_buckets(self):
        conf = Config(
            TC_AWS_ALLOWED_BUCKETS=['whitelist_bucket'],
            TC_AWS_LOADER_BUCKET=None,
        )

        image = yield presigning_loader.load(Context(config=conf),
                                             '/'.join([s3_bucket, IMAGE_PATH]))
        self.assertIsNone(image)
コード例 #18
0
    def test_should_use_http_loader(self, load_sync_patch):
        def cb(a, b, callback, *args, **kwargs):
            callback('foobar')
            return None

        load_sync_patch.side_effect = cb

        conf = Config(TC_AWS_ENABLE_HTTP_LOADER=True)
        presigning_loader.load(Context(config=conf), 'http://foo.bar')
        self.assertTrue(load_sync_patch.called)
コード例 #19
0
ファイル: presigning_loader_vows.py プロジェクト: phoet/aws
 def topic(self, callback):
     conf = Config(TC_AWS_ENDPOINT_URL='http://test.example.com:9000',
                   TC_AWS_CONFIG={
                       's3': {
                           'addressing_style': 'path'
                       },
                       'signature_version': 's3v4'
                   })
     context = Context(config=conf)
     presigning_loader._generate_presigned_url(context, "bucket-name",
                                               "some-s3-key", callback)
コード例 #20
0
    def test_can_load_image(self):
        client = botocore.session.get_session().create_client('s3')
        client.create_bucket(Bucket=s3_bucket)

        client.put_object(
            Bucket=s3_bucket,
            Key=''.join(['root_path', IMAGE_PATH]),
            Body=IMAGE_BYTES,
            ContentType='image/jpeg',
        )

        conf = Config(TC_AWS_LOADER_BUCKET=s3_bucket,
                      TC_AWS_LOADER_ROOT_PATH='root_path')

        image = yield s3_loader.load(Context(config=conf), IMAGE_PATH)
        self.assertEqual(image, IMAGE_BYTES)
コード例 #21
0
        def topic(self):
            conn = boto.connect_s3()
            bucket = conn.create_bucket(s3_bucket)

            k = Key(bucket)
            k.key = IMAGE_PATH
            k.set_contents_from_string(IMAGE_BYTES)

            conf = Config()
            conf.define('TC_AWS_LOADER_BUCKET', s3_bucket, '')
            conf.define('TC_AWS_LOADER_ROOT_PATH', 'root_path', '')

            return Context(config=conf)
コード例 #22
0
    def test_can_build_presigned_url(self):
        context = Context(config=(Config()))
        url = yield presigning_loader._generate_presigned_url(
            context, "bucket-name", "some-s3-key")

        url = urlparse(url)
        self.assertEqual(url.scheme[0:4], 'http')
        self.assertEqual(url.path, '/bucket-name/some-s3-key')

        url_params = parse_qs(url.query)
        # We can't test Expires & Signature values as they vary depending on the TZ
        self.assertIn('Expires', url_params)
        self.assertIn('Signature', url_params)

        self.assertDictContainsSubset(
            {
                'AWSAccessKeyId': ['test-key'],
                'x-amz-security-token': ['test-session-token']
            }, url_params)
コード例 #23
0
        def topic(self, callback):
            conn = boto.connect_s3()
            bucket = conn.create_bucket(s3_bucket)

            k = Key(bucket)
            k.key = '/'.join(['root_path', IMAGE_PATH])
            k.set_contents_from_string(IMAGE_BYTES)

            conf = Config()
            conf.define('TC_AWS_LOADER_BUCKET', s3_bucket, '')
            conf.define('TC_AWS_LOADER_ROOT_PATH', 'root_path', '')

            context = Context(config=conf)

            s3_loader.load(context, IMAGE_PATH, callback)
コード例 #24
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(None, conf_name='sample.conf', lookup_paths=['vows/fixtures/'])
コード例 #25
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.alias('LOADER_ALIAS', 'LOADER')
     return Config(LOADER='y')
コード例 #26
0
ファイル: config.py プロジェクト: lmello/thumbor
# -*- coding: utf-8 -*-

# thumbor imaging service
# https://github.com/globocom/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com [email protected]

from os.path import join
import tempfile
import derpconf.config as config
from derpconf.config import Config

Config.define(
    'THUMBOR_LOG_FORMAT', '%(asctime)s %(name)s:%(levelname)s %(message)s',
    'Log Format to be used by thumbor when writing log messages.', 'Logging')

Config.define(
    'THUMBOR_LOG_DATE_FORMAT', '%Y-%m-%d %H:%M:%S',
    'Date Format to be used by thumbor when writing log messages.', 'Logging')

Config.define('MAX_WIDTH', 0, "Max width in pixels for images read or generated by thumbor", 'Imaging')
Config.define('MAX_HEIGHT', 0, "Max height in pixels for images read or generated by thumbor", 'Imaging')
Config.define('MIN_WIDTH', 1, "Min width in pixels for images read or generated by thumbor", 'Imaging')
Config.define('MIN_HEIGHT', 1, "Min width in pixels for images read or generated by thumbor", 'Imaging')
Config.define('ALLOWED_SOURCES', [], "Allowed domains for the http loader to download. These are regular expressions.", 'Imaging')
Config.define('QUALITY', 80, 'Quality index used for generated JPEG images', 'Imaging')
Config.define('MAX_AGE', 24 * 60 * 60, 'Max AGE sent as a header for the image served by thumbor in seconds', 'Imaging')
Config.define(
    'MAX_AGE_TEMP_IMAGE', 0,
コード例 #27
0
 def topic(self, callback):
     conf = Config()
     context = Context(config=conf)
     presigning_loader._generate_presigned_url(context, "bucket-name",
                                               "some-s3-key", callback)
コード例 #28
0
ファイル: config.py プロジェクト: Tideorz/python_aio_demo
import derpconf.config as config
from derpconf.config import Config

#Config.define('MY-KEY', 'DEFAULT VALUE', 'Description for my key', 'Section')
Config.define('PORT', '12345', 'Listened port', 'Application')
Config.define('TEMPLATE_DIR', '.', 'tempalte files directory', 'Template')
Config.define('DATABASE', 'database-demo', 'unuseful, just for demo',
              'Useless')

if __name__ == '__main__':
    config.generate_config()
コード例 #29
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(None,
                        defaults={'DEFAULT': 'DEFAULTVALUE'})
コード例 #30
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.alias('OTHER_ENGINE', 'ENGINE')
     return Config(OTHER_ENGINE='x')
コード例 #31
0
ファイル: __init__.py プロジェクト: gi11es/shortener
extension = Extension('tc_shortener')

# Register the required modules
extension.add_module(
    config_key='SHORTENER_GENERATOR',
    class_name='Generator',
    multiple=False
)

extension.add_module(
    config_key='SHORTENER_STORAGE',
    class_name='Storage',
    multiple=False
)

Config.define('SHORTENER_GENERATOR', 'tc_shortener.generators.short_generator',  'Shortened URL generator class.', 'Shortener')
Config.define('SHORTENER_STORAGE',   'tc_shortener.storages.redis_storage',      'Shortened URL storage.',         'Shortener')

Config.define('SHORTENER_GENERATOR_PRESERVE_NAME', True, 'Should the URL generator preserve the image name in the URL?', 'Shortener')

Config.define('SHORTENER_REDIS_STORAGE_SERVER_HOST',     'localhost', 'Redis hostname.',           'Shortener')
Config.define('SHORTENER_REDIS_STORAGE_SERVER_PORT',     6379,        'Redis port.',               'Shortener')
Config.define('SHORTENER_REDIS_STORAGE_SERVER_PASSWORD', None,        'Redis password.',           'Shortener')
Config.define('SHORTENER_REDIS_STORAGE_SERVER_DB',       0,           'Redis db name (optional).', 'Shortener')

# Register the route
extension.add_handler(UrlShortenerHandler.regex(), UrlShortenerHandler)

Extensions.register(extension)
コード例 #32
0
ファイル: config.py プロジェクト: ettoredn/thumbor
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com [email protected]

from os.path import join
import tempfile

import derpconf.config as config
from derpconf.config import Config

from thumbor import __version__

Config.define('THUMBOR_LOG_CONFIG', None, 'Logging configuration as json', 'Logging')
Config.define(
    'THUMBOR_LOG_FORMAT', '%(asctime)s %(name)s:%(levelname)s %(message)s',
    'Log Format to be used by thumbor when writing log messages.', 'Logging')

Config.define(
    'THUMBOR_LOG_DATE_FORMAT', '%Y-%m-%d %H:%M:%S',
    'Date Format to be used by thumbor when writing log messages.', 'Logging')

Config.define(
  'STATSD_HOST', None,
  'Host to send statsd instrumentation to', 'Logging')

Config.define(
  'STATSD_PREFIX', None,
  'Prefix for statsd', 'Logging')
コード例 #33
0
        def topic(self):

            conf = Config()
            conf.define('TC_AWS_MAX_RETRIES', 3, '')
            return Context(config=conf)
コード例 #34
0
ファイル: presigning_loader_vows.py プロジェクト: Vmadmax/aws
 def topic(self):
     conf = Config()
     return Context(config=conf)
コード例 #35
0
ファイル: presigning_loader_vows.py プロジェクト: pgr0ss/aws
        def topic(self):
            conf = Config()
            conf.define('AWS_ENABLE_HTTP_LOADER', True, '')

            return Context(config=conf)
コード例 #36
0
ファイル: presigning_loader_vows.py プロジェクト: pgr0ss/aws
        def topic(self):
            conf = Config()
            conf.define('S3_ALLOWED_BUCKETS', [], '')

            return Context(config=conf)
コード例 #37
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(
         None, conf_name='not-existent.conf',
         lookup_paths=['vows/fixtures/'],
         defaults={'DEFAULT': 'DEFAULTVALUE'}
     )
コード例 #38
0
ファイル: conf.py プロジェクト: globocom/impim-api
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import derpconf.config as config
from derpconf.config import Config


Config.define('APPLICATION_URL', 'http://0.0.0.0:8080', 'The url to access the running application.', 'General')

Config.define('JSONP_CALLBACK', 'impimCallback', 'Default callback for JSONP responses.', 'General')

Config.define('IMAGES_STORAGE', 'impim_api.domain.storage.FileSystem', 'Defines where the images will be stored.', 'General')
Config.define('METADATA_STORAGE', 'impim_api.domain.storage.ElasticSearch', 'Defines where the metadata will be stored.', 'General')

Config.define('ELASTIC_SEARCH_BASE_URL', 'http://localhost:9200', 'ElasticSearch base url.', 'ElasticSearch')
Config.define('ELASTIC_SEARCH_INDEX', 'impim', 'ElasticSearch index.', 'ElasticSearch')

Config.define('FILE_SYSTEM_ROOT_PATH', '/tmp/impim-api', 'File System root path.', 'File System Storage')

Config.define('AWS_ACCESS_KEY_ID', 'xxx', 'The amazon access key.', 'AWS')
Config.define('AWS_SECRET_ACCESS_KEY', 'yyy', 'The amazon secret key.', 'AWS')
Config.define('AWS_BUCKET_NAME', 'my_bucket', 'The S3 bucket name.', 'AWS')

Config.define('THUMBOR_SECURITY_KEY', 'MY_SECURE_KEY', 'Thumbor security key.', 'Thumbor configuration')
Config.define('THUMBOR_SERVER_URL', 'http://localhost:8888/', 'Thumbor server url.', 'Thumbor configuration')


def generate_config():
    config.generate_config()
コード例 #39
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(None, defaults={'DEFAULT': 'DEFAULTVALUE'})
コード例 #40
0
    def get_context(self):
        conf = Config()
        conf.PNGCRUSH_PATH = self.pngcrush_path
        conf.STATSD_HOST = ''

        return Context(config=conf)
コード例 #41
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.alias('LOADER_ALIAS', 'LOADER')
     return Config(LOADER='y')
コード例 #42
0
def get_handlers(conf):
    DEFAULT_CONF = {'conf': conf, 'middleware_list': get_middleware_list()}

    return [
        url(r"/", HelloTornadoHandler, DEFAULT_CONF),
        url(r"/story/([0-9]+)", StoryHandler, DEFAULT_CONF, name="story"),
        url(r"/login_error",
            LoginErrorHandler,
            DEFAULT_CONF,
            name="login_error"),
    ]


class HelloTornadoApplication(tornado.web.Application):
    def __init__(self, handlers, settings):
        super(HelloTornadoApplication, self).__init__(handlers, settings)


def make_app(conf, handlers):
    return HelloTornadoApplication(
        handlers=handlers,
        settings={'template_path': conf.TEMPLATE_DIR},
    )


if __name__ == '__main__':
    conf = Config.load('settings.conf')
    app = make_app(conf, get_handlers(conf))
    app.listen(conf.PORT)
    tornado.ioloop.IOLoop.current().start()
コード例 #43
0
    def get_context(self):
        conf = Config()
        conf.ZOPFLIPNG_PATH = self.zopflipng_path
        conf.STATSD_HOST = ''

        return Context(config=conf)
コード例 #44
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(fix('sample.conf'))
コード例 #45
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.define('some_key', 'default', 'test key')
     return Config.load(fix('missing.conf'))
コード例 #46
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(None,
                        conf_name='not-existent.conf',
                        lookup_paths=['vows/fixtures/'],
                        defaults={'DEFAULT': 'DEFAULTVALUE'})
コード例 #47
0
    def get_context(self):
        conf = Config()
        conf.OPTIPNG_PATH = self.optipng_path
        conf.STATSD_HOST = ''

        return Context(config=conf)
コード例 #48
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(None,
                        conf_name='sample.conf',
                        lookup_paths=['vows/fixtures/'])
コード例 #49
0
        def topic(self):
            conf = Config()
            conf.define('TC_AWS_ALLOWED_BUCKETS', [], '')

            return Context(config=conf)
コード例 #50
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(fix('sample.conf'),
                        defaults={'PROPER': 'PROPERVALUE'})
コード例 #51
0
ファイル: config.py プロジェクト: krynble/thumbor
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com [email protected]

from os.path import join
import tempfile

import derpconf.config as config
from derpconf.config import Config

from thumbor import __version__

Config.define('THUMBOR_LOG_CONFIG', None, 'Logging configuration as json',
              'Logging')
Config.define('THUMBOR_LOG_FORMAT',
              '%(asctime)s %(name)s:%(levelname)s %(message)s',
              'Log Format to be used by thumbor when writing log messages.',
              'Logging')

Config.define('THUMBOR_LOG_DATE_FORMAT', '%Y-%m-%d %H:%M:%S',
              'Date Format to be used by thumbor when writing log messages.',
              'Logging')

Config.define('STATSD_HOST', None, 'Host to send statsd instrumentation to',
              'Logging')

Config.define('STATSD_PREFIX', None, 'Prefix for statsd', 'Logging')

Config.define('MAX_WIDTH', 0,
コード例 #52
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     return Config.load(fix('sample.conf'), defaults={
         'PROPER': 'PROPERVALUE'
     })
コード例 #53
0
# -*- coding: utf-8 -*-
# System imports
# Third-party imports
from derpconf.config import Config
from tc_core import Extension, Extensions

# Local imports
from thumbor_aliases.handlers.aliases import UrlAliasesHandler

extension = Extension('thumbor_aliases')

# Register modules for settings
extension.add_module(config_key='ALIASES_STORAGE',
                     class_name='AliasesStorage',
                     multiple=False)

# Register main handler
extension.add_handler(UrlAliasesHandler.regex(), UrlAliasesHandler)

# Define settings
Config.define('ALIASES_STORAGE', 'thumbor_aliases.storages.yml_file',
              'Aliases storage class', 'URL Aliases')
Config.define('ALIASES_STORAGE_FILE', '~/aliases.yml', 'Aliases file name')

Extensions.register(extension)
コード例 #54
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.alias('OTHER_ENGINE', 'ENGINE')
     return Config(OTHER_ENGINE='x')
コード例 #55
0
        def topic(self):
            conf = Config()
            conf.define('TC_AWS_ENABLE_HTTP_LOADER', True, '')

            return Context(config=conf)
コード例 #56
0
ファイル: __init__.py プロジェクト: heynemann/gaas
#!/usr/bin/python
# -*- coding: utf-8 -*-

from derpconf.config import Config  # NOQA

Config.define(
    'STORAGE',
    'gaas.storage.sqlalchemy.SqlAlchemyStorage',
    'Storage to be used when saving information about repositories or users',
    'Storage'
)

Config.define('MONGO_DATABASES', {
    'default': {
        'host': 'localhost',
        'port': 4445,
        'database': 'gaas',
    }
}, 'MongoDB Database connection.', 'Database')

Config.define(
    'GIT_ROOT',
    '/tmp/gaas/gitroot',
    'Root folder to store git repositories.',
    'Git'
)
コード例 #57
0
ファイル: config.py プロジェクト: premisedata/thumbor
# -*- coding: utf-8 -*-

# thumbor imaging service
# https://github.com/globocom/thumbor/wiki

# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com [email protected]

from os.path import join
import tempfile
import derpconf.config as config
from derpconf.config import Config


Config.define("MAX_WIDTH", 0, "Max width in pixels for images read or generated by thumbor", "Imaging")
Config.define("MAX_HEIGHT", 0, "Max height in pixels for images read or generated by thumbor", "Imaging")
Config.define("MIN_WIDTH", 1, "Min width in pixels for images read or generated by thumbor", "Imaging")
Config.define("MIN_HEIGHT", 1, "Min width in pixels for images read or generated by thumbor", "Imaging")
Config.define(
    "ALLOWED_SOURCES", [], "Allowed domains for the http loader to download. These are regular expressions.", "Imaging"
)
Config.define("QUALITY", 80, "Quality index used for generated JPEG images", "Imaging")
Config.define("MAX_AGE", 24 * 60 * 60, "Max AGE sent as a header for the image served by thumbor in seconds", "Imaging")
Config.define(
    "MAX_AGE_TEMP_IMAGE",
    0,
    "Indicates the Max AGE header in seconds for temporary images (images that haven't been detected yet)",
    "Imaging",
)
Config.define(
コード例 #58
0
ファイル: __init__.py プロジェクト: heynemann/level
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# this file is part of level.
# https://github.com/heynemann/level

# licensed under the mit license:
# http://www.opensource.org/licenses/mit-license
# copyright (c) 2016, bernardo heynemann <*****@*****.**>


import derpconf.config as config
from derpconf.config import Config

Config.define('LEVEL_LOG_CONFIG', None, 'Logging configuration as json', 'Logging')
Config.define(
    'LEVEL_LOG_FORMAT', '%(asctime)s %(name)s:%(levelname)s %(message)s',
    'Log Format to be used by level when writing log messages.', 'Logging'
)

Config.define(
    'LEVEL_LOG_DATE_FORMAT', '%Y-%m-%d %H:%M:%S',
    'Date Format to be used by level when writing log messages.', 'Logging'
)

Config.define(
    'APP_CLASS', 'level.app.LevelApp',
    'Custom app class to override LevelApp.', 'WebServer',
)

Config.define(
コード例 #59
0
ファイル: settings.py プロジェクト: chrmorais/olhoneles
import sys

from derpconf.config import Config


def INSTANCE(x):
    return os.path.join(os.path.dirname(__file__), x)


if 'test' in sys.argv:
    config_file = INSTANCE('tests.config')
else:
    config_file = INSTANCE('local.config')

if os.path.isfile(config_file):
    conf = Config.load(config_file)
else:
    conf = Config()

DEBUG = conf.get('DEBUG', True)

ADMINS = conf.get('ADMINS', ())

MANAGERS = ADMINS

DEAFAULT_DATABASE = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': INSTANCE('db.sqlite3'),
        'USER': '',
        'PASSWORD': '',
コード例 #60
0
ファイル: config_vows.py プロジェクト: marcelometal/derpconf
 def topic(self):
     Config.alias('STORAGE_ALIAS', 'STORAGE')
     Config.alias('STORAGE_ALIAS_ALIAS', 'STORAGE_ALIAS')
     return Config(STORAGE_ALIAS_ALIAS='z')