import os from celery.signals import setup_logging import chibi_donkey as donkey from chibi.snippet.dict import get_regex, lower_keys from cmreslogging.handlers import CMRESHandler app_name = os.environ.get('QUETZALCOATL__APP_NAME') elastic_logger_env_vars = donkey.inflate( lower_keys(get_regex(os.environ, r'LOGGER__ELASTIC__.+'))) for e in elastic_logger_env_vars['logger']['elastic'].values(): e['auth_details'] = ( e['user'], e['password'], ) e['auth_type'] = CMRESHandler.AuthType.BASIC_AUTH # e[ 'ca_certs' ] = certifi.where() e['class'] = 'cmreslogging.handlers.CMRESHandler' e['flush_frequency_in_sec'] = int(e['flush_frequency_in_sec']) e['hosts'] = [e['hosts']] e['use_ssl'] = True e['verify_ssl'] = True e['es_additional_fields'] = { 'app': app_name, 'tags': ['reader_moe', app_name] } if e['index_name_frequency'] == 'monthly':
import os import chibi_donkey as donkey from chibi.snippet.dict import get_regex, lower_keys rest_envars = donkey.inflate( lower_keys(get_regex(os.environ, r'QUETZALCOATL__REST__.+')))['quetzalcoatl']['rest'] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'chibi_user.authentication.Token_simple_authentication', ], 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', #'rest_framework_xml.renderers.XMLRenderer', #'rest_framework_yaml.renderers.YAMLRenderer', ), 'DEFAULT_PARSER_CLASSES': ( 'rest_framework.parsers.JSONParser', #'rest_framework_xml.parsers.XMLParser', #'rest_framework_yaml.parsers.YAMLParser', ), 'DEFAULT_FILTER_BACKENDS': ( 'django_filters.rest_framework.DjangoFilterBackend', 'rest_framework.filters.OrderingFilter', ), 'DEFAULT_CONTENT_NEGOTIATION_CLASS':
import os import chibi_donkey as donkey from chibi.snippet.dict import get_regex, lower_keys from elasticsearch_dsl.connections import connections elastic_env_vars = donkey.inflate( lower_keys(get_regex(os.environ, r'ELASTIC__.+')))['elastic'] for e in elastic_env_vars.values(): e['timeout'] = int(e['timeout']) for e in elastic_env_vars.values(): e['hosts'] = [e['hosts']] # e[ 'http_auth' ] = ( e[ 'user' ], e[ 'password' ] ) connections.configure(**elastic_env_vars)
import os import chibi_donkey as donkey from chibi.snippet.dict import get_regex, lower_keys rest_envars = donkey.inflate( lower_keys( get_regex(os.environ, r'{{ cookiecutter.project_slug|upper }}__REST__.+')) )['{{ cookiecutter.project_slug }}']['rest'] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'chibi_user.authentication.Token_simple_authentication', ], 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', 'rest_framework_xml.renderers.XMLRenderer', 'rest_framework_yaml.renderers.YAMLRenderer', ), 'DEFAULT_PARSER_CLASSES': ( 'rest_framework.parsers.JSONParser', 'rest_framework_xml.parsers.XMLParser', 'rest_framework_yaml.parsers.YAMLParser', ), 'DEFAULT_FILTER_BACKENDS': ( 'django_filters.rest_framework.DjangoFilterBackend', 'rest_framework.filters.OrderingFilter',
import os import chibi_donkey as donkey from chibi.snippet.dict import get_regex, lower_keys rest_envars = donkey.inflate( lower_keys(get_regex(os.environ, r'CORONA_CHAN__REST__.+')))['corona_chan']['rest'] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'chibi_user.authentication.Token_simple_authentication', ], 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated', ), 'DEFAULT_RENDERER_CLASSES': ( 'rest_framework.renderers.JSONRenderer', # 'rest_framework_xml.renderers.XMLRenderer', # 'rest_framework_yaml.renderers.YAMLRenderer', ), 'DEFAULT_PARSER_CLASSES': ( 'rest_framework.parsers.JSONParser', # 'rest_framework_xml.parsers.XMLParser', # 'rest_framework_yaml.parsers.YAMLParser', ), 'DEFAULT_FILTER_BACKENDS': ( 'django_filters.rest_framework.DjangoFilterBackend', 'rest_framework.filters.OrderingFilter', ), 'DEFAULT_CONTENT_NEGOTIATION_CLASS':