def get_verify_test_provider_settings_parser(provider): """ Returns a parser for parsing verify test provider settings. """ parser = SettingsParser('VERIFY_TEST_{}_PROVIDER'.format(provider.upper())) provider_class = get_provider_class(provider) provider_class.configure_parser('test', parser) for key in parser.settings: # plugin will try to get the provider config for test verification api # the config is not necessarily required. # For example, nexmo and twilio are provided by user from test api parser.settings[key] = parser.settings[key]._replace(required=False) return parser
def get_verify_settings_parser_for_key_and_provider(key, provider): """ Returns a parser for parsing verify settings for a specified key and provider. """ parser = SettingsParser('VERIFY_KEYS_{}_PROVIDER'.format( key.upper(), provider.upper())) provider_class = get_provider_class(provider) provider_class.configure_parser(key, parser) return parser
from .initialize import register_initialization_event_handlers from .message_handlers import register_message_hooks, register_message_lambdas from .receipt_handlers import register_receipt_hooks, register_receipt_lambdas from .typing import register_typing_lambda from .user_conversation import (register_user_conversation_hooks, register_user_conversation_lambdas) def includeme(settings): register_initialization_event_handlers(settings) register_conversation_hooks(settings) register_conversation_lambdas(settings) register_message_hooks(settings) register_message_lambdas(settings) register_receipt_hooks(settings) register_receipt_lambdas(settings) register_user_conversation_hooks(settings) register_user_conversation_lambdas(settings) register_typing_lambda(settings) parser = SettingsParser('SKYGEAR_CHAT') parser.add_setting('asset_store_url_prefix', default='http://localhost:3000/', env_var='ASSET_STORE_URL_PREFIX') parser.add_setting('asset_store_secret', default='', env_var='ASSET_STORE_SECRET') add_parser('chat', parser)
def get_welcome_email_settings_parser(): parser = SettingsParser('FORGOT_PASSWORD_WELCOME_EMAIL') parser.add_setting('enable', atype=bool, resolve=False, required=False, default=False) parser.add_setting('sender_name', resolve=False, required=False, default='') parser.add_setting('sender', resolve=False, default='*****@*****.**') parser.add_setting('subject', resolve=False, default='Welcome!') parser.add_setting('reply_to_name', resolve=False, required=False, default='') parser.add_setting('reply_to', resolve=False, required=False) parser.add_setting('text_url', resolve=False, required=False) parser.add_setting('html_url', resolve=False, required=False) return parser
def get_smtp_settings_parser(): parser = SettingsParser('SMTP') parser.add_setting('host', resolve=False, required=False) parser.add_setting('port', resolve=False, default=25, atype=int) parser.add_setting('mode', resolve=False, default='normal') parser.add_setting('login', resolve=False, default='') parser.add_setting('password', resolve=False, default='') return parser
def get_verify_settings_parser_for_key(key): """ Returns a parser for parsing verify settings for a specified key. """ parser = SettingsParser('VERIFY_KEYS_{}'.format(key.upper())) parser.add_setting('code_format', atype=str, resolve=False, required=False, default='numeric') parser.add_setting( 'expiry', atype=int, resolve=False, required=False, default=60 * 60 * 24 # 1 day ) parser.add_setting('success_redirect', atype=str, resolve=False, required=False) parser.add_setting('error_redirect', atype=str, resolve=False, required=False) parser.add_setting('success_html_url', atype=str, resolve=False, required=False) parser.add_setting('error_html_url', atype=str, resolve=False, required=False) parser.add_setting('provider', atype=get_verify_settings_provider_type(key), resolve=False, required=True) return parser
def get_settings_parser(): parser = SettingsParser('FORGOT_PASSWORD') # TODO(cheungpat): py-skygear will have support for specifying # a callable in default param. When that happens, the app name # and endpoint should be specified via a function. # parser.add_setting('app_name', default=skyoptions.appname) # parser.add_setting('url_prefix', default=skyoptions.skygear_endpoint) parser.add_setting('app_name', default=getattr(skyoptions, 'appname', None), required=False) parser.add_setting('url_prefix', default=getattr(skyoptions, 'skygear_endpoint', None), required=False) parser.add_setting('secure_match', atype=bool, required=False, resolve=False, default=False) parser.add_setting('sender_name', resolve=False, required=False, default='') parser.add_setting('sender', resolve=False, default='*****@*****.**') parser.add_setting('subject', resolve=False, default='Reset password instructions') parser.add_setting('reply_to_name', resolve=False, required=False, default='') parser.add_setting('reply_to', resolve=False, required=False) parser.add_setting('reset_url_lifetime', atype=int, resolve=False, required=False, default=43200) parser.add_setting('success_redirect', resolve=False, required=False) parser.add_setting('error_redirect', resolve=False, required=False) parser.add_setting('email_text_url', resolve=False, required=False) parser.add_setting('email_html_url', resolve=False, required=False) parser.add_setting('reset_html_url', resolve=False, required=False) parser.add_setting('reset_success_html_url', resolve=False, required=False) parser.add_setting('reset_error_html_url', resolve=False, required=False) return parser
def get_verify_settings_parser(): """ Returns a parser for parsing verify settings. """ parser = SettingsParser('VERIFY') parser.add_setting('keys', atype=get_verify_settings_keys_type(), resolve=False, required=False, default={}) parser.add_setting('auto_update', atype=bool, resolve=False, required=False, default=False) parser.add_setting('auto_send_signup', atype=bool, resolve=False, required=False, default=False) parser.add_setting('auto_send_update', atype=bool, resolve=False, required=False, default=False) parser.add_setting('required', atype=bool, resolve=False, required=False, default=False) parser.add_setting('criteria', atype=str, resolve=False, required=False, default='any') parser.add_setting('modify_schema', atype=bool, resolve=False, default=True) parser.add_setting('modify_acl', atype=bool, resolve=False, default=True) parser.add_setting('error_redirect', atype=str, resolve=False, required=False) parser.add_setting('error_html_url', atype=str, resolve=False, required=False) return parser
from .conversation_handlers import (register_conversation_hooks, register_conversation_lambdas) from .decorators import (after_conversation_created, after_conversation_deleted, after_conversation_updated, after_message_deleted, after_message_sent, after_message_updated, after_users_added_to_conversation, after_users_removed_from_conversation, typing_started) from .initialize import register_initialization_event_handlers from .message_handlers import register_message_hooks, register_message_lambdas from .receipt_handlers import register_receipt_hooks, register_receipt_lambdas from .typing import register_typing_lambda from .user_conversation import register_user_conversation_lambdas def includeme(settings): register_initialization_event_handlers(settings) register_conversation_hooks(settings) register_conversation_lambdas(settings) register_message_hooks(settings) register_message_lambdas(settings) register_receipt_hooks(settings) register_receipt_lambdas(settings) register_user_conversation_lambdas(settings) register_typing_lambda(settings) parser = SettingsParser('SKYGEAR_CHAT') add_parser('chat', parser)
def get_settings_parser(): parser = SettingsParser('FORGOT_PASSWORD') parser.add_setting('app_name', default=skyoptions.appname) parser.add_setting('url_prefix', default=skyoptions.skygear_endpoint) parser.add_setting('secure_match', atype=bool, required=False, resolve=False, default=False) parser.add_setting('sender', resolve=False, default='*****@*****.**') parser.add_setting('subject', resolve=False, default='Reset password instructions') parser.add_setting('reply_to', resolve=False, required=False) parser.add_setting('reset_url_lifetime', atype=int, resolve=False, required=False, default=43200) parser.add_setting('success_redirect', resolve=False, required=False) parser.add_setting('error_redirect', resolve=False, required=False) parser.add_setting('email_text_url', resolve=False, required=False) parser.add_setting('email_html_url', resolve=False, required=False) parser.add_setting('reset_html_url', resolve=False, required=False) parser.add_setting('reset_success_html_url', resolve=False, required=False) parser.add_setting('reset_error_html_url', resolve=False, required=False) return parser