Skip to content

Commit 61d8065

Browse files
Move webserver expose_hostname config to fab (#50269) (#50605)
(cherry picked from commit 7c29214)
1 parent bcf1630 commit 61d8065

File tree

7 files changed

+22
-10
lines changed

7 files changed

+22
-10
lines changed

airflow-core/src/airflow/cli/commands/config_command.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ def message(self) -> str | None:
383383
config=ConfigParameter("webserver", "access_denied_message"),
384384
renamed_to=ConfigParameter("fab", "access_denied_message"),
385385
),
386+
ConfigChange(
387+
config=ConfigParameter("webserver", "expose_hostname"),
388+
renamed_to=ConfigParameter("fab", "expose_hostname"),
389+
),
386390
ConfigChange(
387391
config=ConfigParameter("webserver", "base_url"),
388392
renamed_to=ConfigParameter("api", "base_url"),

airflow-core/src/airflow/config_templates/config.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1741,13 +1741,6 @@ webserver:
17411741
sensitive: true
17421742
example: ~
17431743
default: "{SECRET_KEY}"
1744-
expose_hostname:
1745-
description: |
1746-
Expose hostname in the web server
1747-
version_added: 1.10.8
1748-
type: string
1749-
example: ~
1750-
default: "False"
17511744
grid_view_sorting_order:
17521745
description: |
17531746
Sorting order in grid view. Valid values are: ``topological``, ``hierarchical_alphabetical``

airflow-core/src/airflow/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def sensitive_config_values(self) -> set[tuple[str, str]]:
357357
("triggerer", "capacity"): ("triggerer", "default_capacity", "3.0"),
358358
("api", "expose_config"): ("webserver", "expose_config", "3.0.1"),
359359
("fab", "access_denied_message"): ("webserver", "access_denied_message", "3.0.2"),
360+
("fab", "expose_hostname"): ("webserver", "expose_hostname", "3.0.2"),
360361
}
361362

362363
# A mapping of new section -> (old section, since_version).

providers/fab/provider.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ config:
6464
type: string
6565
example: ~
6666
default: "Access is Denied"
67+
expose_hostname:
68+
description: |
69+
Expose hostname in the web server
70+
version_added: 2.0.3
71+
type: string
72+
example: ~
73+
default: "False"
6774
auth_rate_limited:
6875
description: |
6976
Boolean for enabling rate limiting on authentication endpoints.

providers/fab/src/airflow/providers/fab/get_provider_info.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ def get_provider_info():
3737
"example": None,
3838
"default": "Access is Denied",
3939
},
40+
"expose_hostname": {
41+
"description": "Expose hostname in the web server\n",
42+
"version_added": "2.0.3",
43+
"type": "string",
44+
"example": None,
45+
"default": "False",
46+
},
4047
"auth_rate_limited": {
4148
"description": "Boolean for enabling rate limiting on authentication endpoints.\n",
4249
"version_added": "1.0.2",

providers/fab/src/airflow/providers/fab/www/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _has_access(*, is_authorized: bool, func: Callable, args, kwargs):
145145
return (
146146
render_template(
147147
"airflow/no_roles_permissions.html",
148-
hostname=get_hostname() if conf.getboolean("webserver", "EXPOSE_HOSTNAME") else "",
148+
hostname=get_hostname() if conf.getboolean("fab", "EXPOSE_HOSTNAME") else "",
149149
logout_url=get_fab_auth_manager().get_url_logout(),
150150
),
151151
403,
@@ -217,7 +217,7 @@ def decorated(*args, **kwargs):
217217
return (
218218
render_template(
219219
"airflow/no_roles_permissions.html",
220-
hostname=get_hostname() if conf.getboolean("webserver", "EXPOSE_HOSTNAME") else "",
220+
hostname=get_hostname() if conf.getboolean("fab", "EXPOSE_HOSTNAME") else "",
221221
logout_url=get_auth_manager().get_url_logout(),
222222
),
223223
403,

providers/fab/src/airflow/providers/fab/www/extensions/init_jinja_globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def init_jinja_globals(app, enable_plugins: bool):
3737
elif server_timezone == "utc":
3838
server_timezone = "UTC"
3939

40-
expose_hostname = conf.getboolean("webserver", "EXPOSE_HOSTNAME")
40+
expose_hostname = conf.getboolean("fab", "EXPOSE_HOSTNAME")
4141
hostname = get_hostname() if expose_hostname else "redact"
4242

4343
try:

0 commit comments

Comments
 (0)