proxy_fastly: reading config requires app context
This commit is contained in:
parent
e1b498628d
commit
36fc803b72
1 changed files with 5 additions and 1 deletions
|
@ -11,7 +11,6 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
short_name = "proxy_fastly"
|
short_name = "proxy_fastly"
|
||||||
description = "Deploy proxies to Fastly"
|
description = "Deploy proxies to Fastly"
|
||||||
provider = "fastly"
|
provider = "fastly"
|
||||||
subgroup_max = min(current_app.config.get("FASTLY_MAX_BACKENDS", 5), 20)
|
|
||||||
|
|
||||||
template_parameters = [
|
template_parameters = [
|
||||||
"aws_access_key",
|
"aws_access_key",
|
||||||
|
@ -114,6 +113,11 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
{% endfor %}{# group #}
|
{% endfor %}{# group #}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
# Requires Flask application context to read configuration
|
||||||
|
self.subgroup_max = min(current_app.config.get("FASTLY_MAX_BACKENDS", 5), 20)
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
def import_state(self, state: Optional[Any]) -> None:
|
def import_state(self, state: Optional[Any]) -> None:
|
||||||
proxies = Proxy.query.filter(
|
proxies = Proxy.query.filter(
|
||||||
Proxy.provider == self.provider,
|
Proxy.provider == self.provider,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue