예제 #1
0
파일: boot.py 프로젝트: claytondaley/salmon
from config import settings
from salmon.routing import Router
from salmon.server import Relay, SMTPReceiver
from salmon import view
import logging
import logging.config
import jinja2
from app.model import state_storage

logging.config.fileConfig("config/logging.conf")

# the relay host to actually send the final message to
settings.relay = Relay(host=settings.relay_config['host'],
                       port=settings.relay_config['port'],
                       debug=1)

# where to listen for incoming messages
settings.receiver = SMTPReceiver(settings.receiver_config['host'],
                                 settings.receiver_config['port'])

Router.defaults(**settings.router_defaults)
Router.load(settings.handlers)
Router.RELOAD = True
Router.LOG_EXCEPTIONS = True
Router.STATE_STORE = state_storage.UserStateStorage()

view.LOADER = jinja2.Environment(loader=jinja2.PackageLoader(
    settings.template_config['dir'], settings.template_config['module']))
예제 #2
0
파일: settings.py 프로젝트: Kunal18/Inboxen
import os
import sys

from salmon.server import SMTPReceiver, LMTPReceiver

sys.path.append('..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'inboxen.settings'

from django.conf import settings
import django

django.setup()

# where to listen for incoming messages
if settings.SALMON_SERVER["type"] == "lmtp":
    receiver = LMTPReceiver(socket=settings.SALMON_SERVER["path"])
elif settings.SALMON_SERVER["type"] == "smtp":
    receiver = SMTPReceiver(settings.SALMON_SERVER['host'],
                            settings.SALMON_SERVER['port'])
예제 #3
0
파일: boot.py 프로젝트: 3nprob/Inboxen
from salmon.routing import Router
from salmon.server import LMTPReceiver, SMTPReceiver

from inboxen.router.config import settings

__all__ = ["settings"]

try:
    os.mkdir("logs", 0o700)
except OSError:
    pass

try:
    os.mkdir("run", 0o710)  # group can access files in "run"
except OSError:
    pass

logging.config.dictConfig(dj_settings.SALMON_LOGGING)

# where to listen for incoming messages
if dj_settings.SALMON_SERVER["type"] == "lmtp":
    settings.receiver = LMTPReceiver(socket=dj_settings.SALMON_SERVER["path"])
elif dj_settings.SALMON_SERVER["type"] == "smtp":
    settings.receiver = SMTPReceiver(dj_settings.SALMON_SERVER['host'],
                                     dj_settings.SALMON_SERVER['port'])

Router.load(['inboxen.router.server'])
Router.RELOAD = False
Router.LOG_EXCEPTIONS = True
Router.UNDELIVERABLE_QUEUE = queue.Queue("run/undeliverable")
예제 #4
0
import logging
import logging.config

from salmon import queue
from salmon.routing import Router
from salmon.server import SMTPReceiver

from . import settings

logging.config.fileConfig("tests/config/logging.conf")

settings.receiver = SMTPReceiver(**settings.receiver_config)

Router.defaults(**settings.router_defaults)
Router.load(settings.dump_handlers)
Router.RELOAD = True
Router.UNDELIVERABLE_QUEUE = queue.Queue(settings.UNDELIVERABLE_QUEUE)