예제 #1
0
    def test_can_get_config_from_path(self):
        config = get_config("./tests/fixtures/thumbor_config_server_test.conf")

        with mock.patch.dict("os.environ", {"ENGINE": "test"}):
            expect(config).not_to_be_null()
            expect(config.ALLOWED_SOURCES).to_be_like(["mydomain.com"])
            expect(config.ENGINE).to_be_like("thumbor.engines.pil")
예제 #2
0
    def test_can_get_config_with_env_enabled(self):
        config = get_config('./tests/fixtures/thumbor_config_server_test.conf', True)

        with mock.patch.dict('os.environ', {'ENGINE': 'test'}):
            expect(config).not_to_be_null()
            expect(config.ALLOWED_SOURCES).to_be_like(['mydomain.com'])
            expect(config.ENGINE).to_be_like('test')
예제 #3
0
    def test_can_get_config_from_path(self):
        config = get_config('./tests/fixtures/thumbor_config_server_test.conf')

        with mock.patch.dict('os.environ', {'ENGINE': 'test'}):
            expect(config).not_to_be_null()
            expect(config.ALLOWED_SOURCES).to_be_like(['mydomain.com'])
            expect(config.ENGINE).to_be_like('thumbor.engines.pil')
예제 #4
0
    def test_can_get_config_from_path(self):
        config = get_config('./tests/fixtures/thumbor_config_server_test.conf')

        expect(config).not_to_be_null()
        expect(config.ALLOWED_SOURCES).to_be_like(['mydomain.com'])
예제 #5
0
    def test_can_get_config_from_path(self):
        config = get_config('./tests/fixtures/thumbor_config_server_test.conf')

        expect(config).not_to_be_null()
        expect(config.ALLOWED_SOURCES).to_be_like(['mydomain.com'])
예제 #6
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from thumbor.console import get_server_parameters
from thumbor.server import get_config, configure_log
from thumbor.server import get_importer, validate_config
from thumbor.server import get_context, get_application

thumbor_port = os.environ.get('THUMBOR_PORT') or '8000'
log_level = os.environ.get('LOG_LEVEL') or 'info'

arguments = [
    '--conf=/app/thumbor.conf', '--port=' + thumbor_port,
    '--log-level=' + log_level
]

server_parameters = get_server_parameters(arguments)

config = get_config(server_parameters.config_path)

configure_log(config, server_parameters.log_level.upper())

importer = get_importer(config)

validate_config(config, server_parameters)

context = get_context(server_parameters, config, importer)

application = get_application(context)