feat: rate limiting
This commit is contained in:
+13
-5
@@ -15,7 +15,8 @@ class Parameters:
|
||||
port: int = 5000
|
||||
workers: int = 4
|
||||
timeout: int = 120
|
||||
db_url: str = "postgres://postgres:5432/tout-doux"
|
||||
db_uri: str = "postgres://localhost:5432/tout-doux"
|
||||
cache_uri: str = "redis://localhost:6379"
|
||||
|
||||
@classmethod
|
||||
def from_namespace(cls, args: argparse.Namespace) -> Parameters:
|
||||
@@ -115,10 +116,17 @@ def parse_parameters(args: typing.Sequence[str]) -> Parameters:
|
||||
)
|
||||
__add_arg_str(
|
||||
parser,
|
||||
"--db-url",
|
||||
env_var="DB_URL",
|
||||
default=default_values.db_url,
|
||||
help_txt="database connection url",
|
||||
"--db-uri",
|
||||
env_var="DB_URI",
|
||||
default=default_values.db_uri,
|
||||
help_txt="database connection URI",
|
||||
)
|
||||
__add_arg_str(
|
||||
parser,
|
||||
"--cache-uri",
|
||||
env_var="CACHE_URI",
|
||||
default=default_values.cache_uri,
|
||||
help_txt="cache connection URI",
|
||||
)
|
||||
parsed_args = parser.parse_args(args)
|
||||
return Parameters.from_namespace(parsed_args)
|
||||
|
||||
Reference in New Issue
Block a user