mockstack 0.9.2__tar.gz → 0.9.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mockstack-0.9.2 → mockstack-0.9.3}/.env.example +1 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/PKG-INFO +1 -1
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/config.py +6 -1
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/proxyrules.py +9 -5
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/PKG-INFO +1 -1
- mockstack-0.9.3/uv.lock +1425 -0
- mockstack-0.9.2/uv.lock +0 -1386
- {mockstack-0.9.2 → mockstack-0.9.3}/.dockerignore +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/workflows/ci.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/workflows/publish-docs.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/workflows/publish-to-dockerhub.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.github/workflows/publish-to-pypi.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.gitignore +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/.pre-commit-config.yaml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/CODE_OF_CONDUCT.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/CONTRIBUTING.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/Dockerfile +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/LICENSE +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/README.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/SECURITY.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docker-entrypoint.sh +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/assets/favicon.ico +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/assets/logo.png +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/assets/mockstack.png +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/configuration.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/ollama.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/strategies/base.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/strategies/filefixtures.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/docs/strategies/proxyrules.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/filefixtures-with-templates/.env.example +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/filefixtures-with-templates/README.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/filefixtures-with-templates/templates/servicename-api-v1-items.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/filefixtures-with-templates/templates/servicename2-api-v2-user.533ec889-7c68-45c8-b21e-4a7e455d1234.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/llm/README.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/llm/mockstack-langchain-example.ipynb +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/llm/templates/ollama-openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/llm/templates/openai-v1-chat-completions.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/llm/templates/openai-v1-deployments-gpt-4o-chat-completions.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/.env.example +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/README.md +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/examples/proxyrules-with-rules-file/rules.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mkdocs.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/constants.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/display.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/exceptions.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/identifiers.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/intent.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/lifespan.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/llm/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/llm/ollama.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/main.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/middleware.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/routers/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/routers/catchall.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/routers/homepage.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/base.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/create_mixin.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/factory.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/strategies/filefixtures.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/telemetry.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/templating.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/conftest.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/fixtures/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/fixtures/proxyrules.yml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/fixtures/templates/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/fixtures/templates/example-template.j2 +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/llm/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/llm/test_ollama.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/routers/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/routers/test_catchall.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/routers/test_homepage.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/strategies/__init__.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/strategies/test_create_mixin.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/strategies/test_filefixtures.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/strategies/test_proxyrules.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_display.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_identifiers.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_intent.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_middleware.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_telemetry.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack/tests/test_templating.py +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/SOURCES.txt +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/dependency_links.txt +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/entry_points.txt +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/requires.txt +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/mockstack.egg-info/top_level.txt +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/pyproject.toml +0 -0
- {mockstack-0.9.2 → mockstack-0.9.3}/setup.cfg +0 -0
|
@@ -18,6 +18,7 @@ FILEFIXTURES_ENABLE_TEMPLATES_FOR_POST = false
|
|
|
18
18
|
MOCKSTACK__PROXYRULES_RULES_FILENAME="/some/path/proxyrules.yml"
|
|
19
19
|
|
|
20
20
|
MOCKSTACK__PROXYRULES_SIMULATE_CREATE_ON_MISSING = true
|
|
21
|
+
MOCKSTACK__PROXYRULES_VERIFY_SSL_CERTIFICATES = true
|
|
21
22
|
|
|
22
23
|
# OpenTelemetry settings
|
|
23
24
|
MOCKSTACK__OPENTELEMETRY__ENABLED = true
|
|
@@ -75,13 +75,18 @@ class Settings(BaseSettings):
|
|
|
75
75
|
# or reverse proxy the request to the target URL "silently".
|
|
76
76
|
proxyrules_redirect_via: ProxyRulesRedirectVia = ProxyRulesRedirectVia.REVERSE_PROXY
|
|
77
77
|
|
|
78
|
-
#
|
|
78
|
+
# default timeout for reverse proxy requests. given in seconds. None disables timeouts.
|
|
79
79
|
proxyrules_reverse_proxy_timeout: float | None = 10.0
|
|
80
80
|
|
|
81
81
|
# controls behavior of proxying. Whether to simulate creation of resources
|
|
82
82
|
# when a POST request is made to a resource that doesn't match any rules..
|
|
83
83
|
proxyrules_simulate_create_on_missing: CliImplicitFlag[bool] = False
|
|
84
84
|
|
|
85
|
+
# controls behavior of proxying. Whether to verify SSL certificates.
|
|
86
|
+
# this is useful for testing against services that use self-signed certificates.
|
|
87
|
+
# disable with caution!
|
|
88
|
+
proxyrules_verify_ssl_certificates: CliImplicitFlag[bool] = True
|
|
89
|
+
|
|
85
90
|
# metadata fields to inject into created resources.
|
|
86
91
|
# A few template fields are available. See documentation for more details.
|
|
87
92
|
created_resource_metadata: CliSuppress[dict[str, Any]] = {
|
|
@@ -68,12 +68,13 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
68
68
|
|
|
69
69
|
def __init__(self, settings: Settings, *args, **kwargs):
|
|
70
70
|
super().__init__(settings, *args, **kwargs)
|
|
71
|
-
self.
|
|
71
|
+
self.created_resource_metadata = settings.created_resource_metadata
|
|
72
|
+
self.missing_resource_fields = settings.missing_resource_fields
|
|
72
73
|
self.redirect_via = settings.proxyrules_redirect_via
|
|
73
74
|
self.reverse_proxy_timeout = settings.proxyrules_reverse_proxy_timeout
|
|
75
|
+
self.rules_filename = settings.proxyrules_rules_filename
|
|
74
76
|
self.simulate_create_on_missing = settings.proxyrules_simulate_create_on_missing
|
|
75
|
-
self.
|
|
76
|
-
self.missing_resource_fields = settings.missing_resource_fields
|
|
77
|
+
self.verify_ssl_certificates = settings.proxyrules_verify_ssl_certificates
|
|
77
78
|
|
|
78
79
|
def __str__(self) -> str:
|
|
79
80
|
return (
|
|
@@ -81,7 +82,8 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
81
82
|
f"rules_filename: {self.rules_filename}.\n "
|
|
82
83
|
f"redirect_via: [medium_purple]{self.redirect_via}[/medium_purple].\n "
|
|
83
84
|
f"simulate_create_on_missing: {self.simulate_create_on_missing}.\n "
|
|
84
|
-
f"reverse_proxy_timeout: {self.reverse_proxy_timeout}"
|
|
85
|
+
f"reverse_proxy_timeout: {self.reverse_proxy_timeout}\n "
|
|
86
|
+
f"verify_ssl_certificates: {self.verify_ssl_certificates}\n "
|
|
85
87
|
)
|
|
86
88
|
|
|
87
89
|
@cached_property
|
|
@@ -153,7 +155,9 @@ class ProxyRulesStrategy(BaseStrategy, CreateMixin):
|
|
|
153
155
|
|
|
154
156
|
async def reverse_proxy(self, request: Request, url: str) -> Response:
|
|
155
157
|
"""Reverse proxy the request to the target URL."""
|
|
156
|
-
async with httpx.AsyncClient(
|
|
158
|
+
async with httpx.AsyncClient(
|
|
159
|
+
timeout=self.reverse_proxy_timeout, verify=self.verify_ssl_certificates
|
|
160
|
+
) as client:
|
|
157
161
|
request_content = await request.body()
|
|
158
162
|
request_headers = self.reverse_proxy_headers(request.headers, url=url)
|
|
159
163
|
req = client.build_request(
|