Set schema url for Swagger via env variable (#2823)
# What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
This commit is contained in:
parent
c9cb4328e8
commit
3d46eea353
3 changed files with 12 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ version: "3.9"
|
|||
x-labels: &oncall-labels
|
||||
- "com.grafana.oncall.env=dev"
|
||||
|
||||
x-user: &oncall-user "appuser"
|
||||
x-user: &oncall-user "root"
|
||||
|
||||
x-oncall-build: &oncall-build-args
|
||||
context: ./engine
|
||||
|
|
|
|||
|
|
@ -260,11 +260,18 @@ SPECTACULAR_SETTINGS = {
|
|||
"SERVE_INCLUDE_SCHEMA": False,
|
||||
# OTHER SETTINGS
|
||||
"PREPROCESSING_HOOKS": [
|
||||
"engine.included_path.custom_preprocessing_hook"
|
||||
], # Custom hook to include only paths from SPECTACULAR_INCLUDED_PATHS
|
||||
"engine.included_path.custom_preprocessing_hook" # Custom hook to include only paths from SPECTACULAR_INCLUDED_PATHS
|
||||
],
|
||||
"SERVE_URLCONF": ("apps.api.urls"),
|
||||
"SWAGGER_UI_SETTINGS": {"supportedSubmitMethods": []}, # Disable "Try it out" button for all endpoints
|
||||
"SWAGGER_UI_SETTINGS": {
|
||||
"supportedSubmitMethods": [], # Disable "Try it out" button for all endpoints
|
||||
},
|
||||
"SERVE_PUBLIC": False,
|
||||
}
|
||||
# Use custom scheme if env var exists
|
||||
SWAGGER_UI_SETTINGS_URL = os.getenv("SWAGGER_UI_SETTINGS_URL")
|
||||
if SWAGGER_UI_SETTINGS_URL:
|
||||
SPECTACULAR_SETTINGS["SWAGGER_UI_SETTINGS"]["url"] = SWAGGER_UI_SETTINGS_URL
|
||||
|
||||
SPECTACULAR_INCLUDED_PATHS = [
|
||||
"/features",
|
||||
|
|
|
|||
|
|
@ -160,4 +160,5 @@ REST_FRAMEWORK = {
|
|||
),
|
||||
"DEFAULT_AUTHENTICATION_CLASSES": [],
|
||||
"DEFAULT_RENDERER_CLASSES": ("rest_framework.renderers.JSONRenderer",),
|
||||
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue