1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
Files
checktheroads-hyperglass/hyperglass/models/config/cache.py

38 lines
1.2 KiB
Python
Raw Normal View History

2020-01-28 09:52:54 -07:00
"""Validation model for Redis cache config."""
2020-02-03 02:35:11 -07:00
# Standard Library
from typing import Union, Optional
2020-02-01 16:11:01 -10:00
2020-02-03 02:35:11 -07:00
# Third Party
from pydantic import SecretStr, StrictInt, StrictStr, StrictBool, IPvAnyAddress
2020-01-28 09:52:54 -07:00
2020-10-11 13:14:07 -07:00
# Local
from ..main import HyperglassModel
2020-01-28 09:52:54 -07:00
class Cache(HyperglassModel):
"""Validation model for params.cache."""
host: Union[IPvAnyAddress, StrictStr] = "localhost"
port: StrictInt = 6379
database: StrictInt = 1
password: Optional[SecretStr]
timeout: StrictInt = 120
show_text: StrictBool = True
2020-02-01 16:11:01 -10:00
class Config:
"""Pydantic model configuration."""
title = "Cache"
description = "Redis server & cache timeout configuration."
fields = {
"host": {"description": "Redis server IP address or hostname."},
"port": {"description": "Redis server TCP port."},
"database": {"description": "Redis server database ID."},
"password": {"description": "Redis authentication password."},
"timeout": {
"description": "Time in seconds query output will be kept in the Redis cache."
},
"show_test": {description: "Show the cache text in the hyperglass UI."},
}