Пример #1
0
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
Пример #2
0
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',
                       resolve=False,
                       default='*****@*****.**')
    parser.add_setting('subject', resolve=False, default='Welcome!')
    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
Пример #3
0
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)
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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