mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
c81ec9aeec
* add support for annotation only fields, fix #34 * adding tests with mypy * adding docs for mypy usage * adding mypy failure test * adding alias tests * tweak mypy tests
30 lines
639 B
Python
30 lines
639 B
Python
from pydantic import DSN, BaseSettings, PyObject
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
redis_host = 'localhost'
|
|
redis_port = 6379
|
|
redis_database = 0
|
|
redis_password: str = None
|
|
|
|
auth_key: str = ...
|
|
|
|
invoicing_cls: PyObject = 'path.to.Invoice'
|
|
|
|
db_name = 'foobar'
|
|
db_user = 'postgres'
|
|
db_password: str = None
|
|
db_host = 'localhost'
|
|
db_port = '5432'
|
|
db_driver = 'postgres'
|
|
db_query: dict = None
|
|
dsn: DSN = None
|
|
|
|
class Config:
|
|
env_prefix = 'MY_PREFIX_' # defaults to 'APP_'
|
|
fields = {
|
|
'auth_key': {
|
|
'alias': 'my_api_key'
|
|
}
|
|
}
|