Plugin for CloeePy Framework
Project description
# CloeePy-Redis
Redis Plugin for the CloeePy Framework
Attaches a Redis connection to CloeePy application context.
## Installation
`pip install CloeePy-Redis`
## Configuration
### Configuration Basics
CloeePy-Redis configuration must be placed under `CloeePy.Plugins.cloeepy_redis` in your config file.
The parameters are simply the available `Redis-Py.StrictRedis` connection parameters. For more
information on possible configurations please see [Redis-Py's Documentation](http://redis-py.readthedocs.io/en/latest/)
```
CloeePy:
...
Plugins:
cloeepy_redis:
host: localhost
port: "6379"
password: "secret"
```
### Customize Plugin Namespace
By default, your Redis connection is available on the CloeePy application context as
`app.redis`. Optionally you can specify a different namespace by which you access
the redis connection via `pluginNamespace`.
```
...
Plugins:
cloeepy_redis:
pluginNamespace: customRedisNS
host: localhost
port: "6379"
password: "secret"
```
Then, you would access your Redis connection on the application context like so:
```
app = CloeePy()
result = app.customRedisNS.ping()
app.log.info(result)
```
### Optional Environment Variables
It's best practice NOT to store sensitive data, such as database usernames and passwords,
in plain-text configuration files. Thus, CloeePy-Redis supports configuring your
password via environment variable.
You need to set the following:
- Password: `CLOEEPY_REDIS_PASSWORD`
By doing so, you can omit `password` in your configuration file.
## Usage
```
import os
from cloeepy import CloeePy
if __name__ == "__main__":
# Required: set config path as environment variable
os.environ["CLOEEPY_CONFIG_PATH"] = "./example-config.yml"
# instantiate application instance
app = CloeePy()
# Make Redis call and log to stdout
app.log.info(app.redis.ping())
```
Redis Plugin for the CloeePy Framework
Attaches a Redis connection to CloeePy application context.
## Installation
`pip install CloeePy-Redis`
## Configuration
### Configuration Basics
CloeePy-Redis configuration must be placed under `CloeePy.Plugins.cloeepy_redis` in your config file.
The parameters are simply the available `Redis-Py.StrictRedis` connection parameters. For more
information on possible configurations please see [Redis-Py's Documentation](http://redis-py.readthedocs.io/en/latest/)
```
CloeePy:
...
Plugins:
cloeepy_redis:
host: localhost
port: "6379"
password: "secret"
```
### Customize Plugin Namespace
By default, your Redis connection is available on the CloeePy application context as
`app.redis`. Optionally you can specify a different namespace by which you access
the redis connection via `pluginNamespace`.
```
...
Plugins:
cloeepy_redis:
pluginNamespace: customRedisNS
host: localhost
port: "6379"
password: "secret"
```
Then, you would access your Redis connection on the application context like so:
```
app = CloeePy()
result = app.customRedisNS.ping()
app.log.info(result)
```
### Optional Environment Variables
It's best practice NOT to store sensitive data, such as database usernames and passwords,
in plain-text configuration files. Thus, CloeePy-Redis supports configuring your
password via environment variable.
You need to set the following:
- Password: `CLOEEPY_REDIS_PASSWORD`
By doing so, you can omit `password` in your configuration file.
## Usage
```
import os
from cloeepy import CloeePy
if __name__ == "__main__":
# Required: set config path as environment variable
os.environ["CLOEEPY_CONFIG_PATH"] = "./example-config.yml"
# instantiate application instance
app = CloeePy()
# Make Redis call and log to stdout
app.log.info(app.redis.ping())
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
CloeePy-Redis-0.0.0.tar.gz
(3.7 kB
view details)
File details
Details for the file CloeePy-Redis-0.0.0.tar.gz
.
File metadata
- Download URL: CloeePy-Redis-0.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c9f96fe672b01347effc7709b1626ed9019a929003cfb6cd6740144c76535e |
|
MD5 | 012229ec48d666f8a0de7d1b5cf91112 |
|
BLAKE2b-256 | a524636d7d45521758a8d04d17189b48a2a781e63fe13ff482a30948b794c9c5 |