def setUp(self): self.app = App() self.app.bind('QueueAsyncDriver', QueueAsyncDriver) self.app.bind('QueueAmqpDriver', QueueAmqpDriver) self.app.bind('QueueDatabaseDriver', QueueDatabaseDriver) self.app.bind('QueueConfig', queue) self.app.bind('Queueable', Queueable) self.app.bind('Container', self.app) self.app.bind('QueueManager', QueueManager(self.app)) self.app.bind('Queue', QueueManager(self.app).driver(self.app.make('QueueConfig').DRIVER)) self.drivers = ['async'] self.modes = ['threading', 'multiprocess'] if env('RUN_AMQP'): self.drivers.append('amqp') if env('RUN_QUEUE_DATABASE'): self.drivers.append('database')
def setup_method(self): self.app = App() self.app.bind('QueueAsyncDriver', QueueAsyncDriver) self.app.bind('QueueAmqpDriver', QueueAmqpDriver) self.app.bind('QueueConfig', queue) self.app.bind('Queueable', Queueable) self.app.bind('Container', self.app) self.app.bind('QueueManager', QueueManager(self.app)) self.drivers = ['async'] if env('RUN_AMQP'): self.drivers.append('amqp')
"""Application Settings.""" import os from masonite.environment import env """Application Name This value is the name of your application. This value is used when the framework needs to place the application's name in a notification or any other location as required by the application or its packages. """ NAME = env('APP_NAME', 'Masonite 2.3') """Application Debug Mode When your application is in debug mode, detailed error messages with stack traces will be shown on every error that occurs within your application. If disabled, a simple generic error page is shown """ DEBUG = env('APP_DEBUG', False) """Secret Key This key is used to encrypt and decrypt various values. Out of the box Masonite uses this key to encrypt or decrypt cookies so you can use it to encrypt and decrypt various values using the Masonite Sign class. Read the documentation on Encryption to find out how. """ KEY = env('APP_KEY', None)
|-------------------------------------------------------------------------- | Database Settings |-------------------------------------------------------------------------- | | Set connection database settings here as a dictionary. Follow the | format below to create additional connection settings. | | @see Orator migrations documentation for more info | """ DATABASES = { 'default': os.environ.get('DB_DRIVER'), 'sqlite': { 'driver': 'sqlite', 'database': os.environ.get('DB_DATABASE') }, 'postgres': { 'driver': 'postgres', 'host': env('DB_HOST'), 'database': env('DB_DATABASE'), 'port': env('DB_PORT'), 'user': env('DB_USERNAME'), 'password': env('DB_PASSWORD'), 'log_queries': env('DB_LOG'), }, } DB = DatabaseManager(DATABASES) Model.set_connection_resolver(DB)
from masonite.environment import LoadEnvironment, env LoadEnvironment() OAUTH = {'access_token': env('GITHUB_ACCESS_TOKEN')}
""" Logging Settings """ import os from masonite.environment import env """Default Channel The default channel will be used by Masonite whenever it needs to use the logging channel. You can switch the channel at any time. """ DEFAULT = env('LOG_CHANNEL', 'single') """Channels Channels dictate how logging drivers will be initialized. Supported Channels: single, daily, stack, terminal, slack, syslog """ CHANNELS = { 'timezone': env('LOG_TIMEZONE', 'UTC'), 'single': { 'driver': 'single', 'level': 'debug', 'path': 'storage/logs/single.log' }, 'stack': { 'driver': 'stack', 'channels': ['single', 'daily', 'slack', 'terminal'] }, 'daily': { 'driver': 'daily',
from masonite.environment import env BROADCASTS = { "default": "pusher", "pusher": { "driver": "pusher", "client": env("PUSHER_CLIENT"), "app_id": env("PUSHER_APP_ID"), "secret": env("PUSHER_SECRET"), "cluster": env("PUSHER_CLUSTER"), "ssl": False, }, }
""" |-------------------------------------------------------------------------- | Load Environment Variables |-------------------------------------------------------------------------- | | Loads in the environment variables when this page is imported. | """ LoadEnvironment() """ The connections here don't determine the database but determine the "connection". They can be named whatever you want. """ DATABASES = { "default": env("DB_CONNECTION"), "sqlite": { "driver": "sqlite", "database": env("DB_DATABASE"), "log_queries": env("DB_LOG"), }, "mysql": { "driver": "mysql", "host": env("DB_HOST"), "database": env("DB_DATABASE"), "port": env("DB_PORT"), "user": env("DB_USERNAME"), "password": env("DB_PASSWORD"), "log_queries": env("DB_LOG"), }, "postgres": {
from masonite.environment import env FROM_EMAIL = env("MAIL_FROM", "*****@*****.**") DRIVERS = { "default": env("MAIL_DRIVER", "terminal"), "smtp": { "host": env("MAIL_HOST"), "port": env("MAIL_PORT"), "username": env("MAIL_USERNAME"), "password": env("MAIL_PASSWORD"), "from": FROM_EMAIL, }, "mailgun": { "domain": env("MAILGUN_DOMAIN"), "secret": env("MAILGUN_SECRET"), "from": FROM_EMAIL, }, "terminal": { "from": FROM_EMAIL, }, }
from masonite.environment import env DRIVERS = { "slack": { "token": env("SLACK_TOKEN", ""), # used for API mode "webhook": env("SLACK_WEBHOOK", ""), # used for webhook mode }, "vonage": { "key": env("VONAGE_KEY", ""), "secret": env("VONAGE_SECRET", ""), "sms_from": env("VONAGE_SMS_FROM", "+33000000000"), }, "database": { "connection": "sqlite", "table": "notifications", }, } DRY = False
|-------------------------------------------------------------------------- | Load Environment Variables |-------------------------------------------------------------------------- | | Loads in the environment variables when this page is imported. | """ LoadEnvironment() """ The connections here don't determine the database but determine the "connection". They can be named whatever you want. """ DATABASES = { 'default': env('DB_CONNECTION', 'sqlite'), 'sqlite': { 'driver': 'sqlite', 'database': env('SQLITE_DB_DATABASE', 'masonite.db'), 'log_queries': env('DB_LOG'), 'prefix': '' }, 'mysql': { 'driver': 'mysql', 'host': env('DB_HOST'), 'database': env('DB_DATABASE'), 'port': env('DB_PORT'), 'user': env('DB_USERNAME'), 'password': env('DB_PASSWORD'), 'log_queries': env('DB_LOG'), },
"""Cache Settings.""" from masonite.environment import env """Cache Driver Caching is a great way to gain an instant speed boost to your application. Very often templates will not change and you can utilize caching to the best by caching your templates forever, monthly or every few seconds Supported: 'disk' """ DRIVER = env('CACHE_DRIVER', 'disk') """Cache Drivers Place all your caching coniguration as a dictionary here. The keys here should correspond to the driver types supported above. Supported: 'disk' """ DRIVERS = { 'disk': { 'location': 'bootstrap/cache' } }
"""Storage Settings.""" from masonite.environment import env """Storage Driver The default driver you will like to use for storing uploads. You may add additional drivers as you need or pip install additional drivers. Supported: 'disk', 's3', 'rackspace', 'googlecloud', 'azure' """ DRIVER = env("STORAGE_DRIVER", "disk") """Storage Drivers Different drivers you can use for storing file uploads. """ DRIVERS = { "disk": { "location": "storage/uploads" }, "s3": { "client": env("S3_CLIENT", "AxJz..."), "secret": env("S3_SECRET", "HkZj..."), "bucket": env("S3_BUCKET", "s3bucket"), }, "rackspace": { "username": env("RACKSPACE_USERNAME", "username"), "secret": env("RACKSPACE_SECRET", "3cd5b0e8..."), "container": env("RACKSPACE_CONTAINER", "masonite"), "region": env("RACKSPACE_REGION", "IAD"), "location": "http://03c8...rackcdn.com/", },
from masonite.environment import env KEY = env("APP_KEY", "-RkDOqXojJIlsF_I8wWiUq_KRZ0PtGWTOZ676u5HtLg=") HASHING = { "default": env("HASHING_FUNCTION", "bcrypt"), "bcrypt": { "rounds": 10 }, "argon2": { "memory": 1024, "threads": 2, "time": 2 }, } APP_URL = env("APP_URL", "http://0.0.0.0:3000/")
| Load Environment Variables |-------------------------------------------------------------------------- | | Loads in the environment variables when this page is imported. | """ LoadEnvironment() """ The connections here don't determine the database but determine the "connection". They can be named whatever you want. """ DATABASES = { 'default': env('DB_CONNECTION', 'sqlite'), 'sqlite': { 'driver': 'sqlite', 'database': env('SQLITE_DB_DATABASE', 'masonite.sqlite3'), 'prefix': '' }, "mysql": { "driver": "mysql", "host": env('DB_HOST'), "user": env("DB_USERNAME"), "password": env("DB_PASSWORD"), "database": env("DB_DATABASE"), "port": env('DB_PORT'), "prefix": "", "grammar": "mysql", "options": {
from masonite.environment import env from masonite.utils.location import base_path DISKS = { "default": "local", "local": { "driver": "file", "path": base_path("storage/framework/filesystem") }, "s3": { "driver": "s3", "client": env("AWS_CLIENT"), "secret": env("AWS_SECRET"), "bucket": env("AWS_BUCKET"), }, } STATICFILES = { # folder # template alias 'storage/static': 'static/', 'storage/static/css': 'css/', 'storage/compiled/css': 'assets/', 'storage/compiled/js': 'js/', 'storage/public': '/', }
"""Broadcast Settings.""" from masonite.environment import env """Broadcast Driver Realtime support is critical for any modern web application. Broadcast drivers allow you to push data from your server to all your clients to show data updates to your clients in real time without having to constantly refresh the page or send constant ajax requests Supported: 'pusher', 'ably' """ DRIVER = env('BROADCAST_DRIVER', 'pusher') """Broadcast Drivers Below is a dictionary of all your driver configurations. Each key in the dictionary should be the name of a driver. """ DRIVERS = { 'pusher': { 'app_id': env('PUSHER_APP_ID', '29382xx..'), 'client': env('PUSHER_CLIENT', 'shS8dxx..'), 'secret': env('PUSHER_SECRET', 'HDGdjss..'), }, 'ably': { 'secret': env('ABLY_SECRET', 'api:key') } }
from masonite.environment import LoadEnvironment, env from masoniteorm.connections import ConnectionResolver # Loads in the environment variables when this page is imported. LoadEnvironment() """ The connections here don't determine the database but determine the "connection". They can be named whatever you want. """ DATABASES = { "default": env("DB_CONNECTION", "sqlite"), "sqlite": { "driver": "sqlite", "database": env("SQLITE_DB_DATABASE", "masonite.sqlite3"), "prefix": "", "log_queries": env("DB_LOG"), }, "mysql": { "driver": "mysql", "host": env("DB_HOST"), "user": env("DB_USERNAME"), "password": env("DB_PASSWORD"), "database": env("DB_DATABASE"), "port": env("DB_PORT"), "prefix": "", "grammar": "mysql", "options": { "charset": "utf8mb4", }, "log_queries": env("DB_LOG"), },
"""Storage Settings.""" from masonite.environment import env """Storage Driver The default driver you will like to use for storing uploads. You may add additional drivers as you need or pip install additional drivers. Supported: 'disk', 's3', 'rackspace', 'googlecloud', 'azure' """ DRIVER = env('STORAGE_DRIVER', 'disk') """Storage Drivers Different drivers you can use for storing file uploads. """ DRIVERS = { 'disk': { 'location': 'storage/uploads' }, 's3': { 'client': env('S3_CLIENT', 'AxJz...'), 'secret': env('S3_SECRET', 'HkZj...'), 'bucket': env('S3_BUCKET', 's3bucket'), }, 'rackspace': { 'username': env('RACKSPACE_USERNAME', 'username'), 'secret': env('RACKSPACE_SECRET', '3cd5b0e8...'), 'container': env('RACKSPACE_CONTAINER', 'masonite'), 'region': env('RACKSPACE_REGION', 'IAD'), 'location': 'http://03c8...rackcdn.com/' },