Skip to content

Commit 226f7f8

Browse files
Move webserver expose_hostname config to fab
1 parent a18a1df commit 226f7f8

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
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
@@ -1707,13 +1707,6 @@ webserver:
17071707
sensitive: true
17081708
example: ~
17091709
default: "{SECRET_KEY}"
1710-
expose_hostname:
1711-
description: |
1712-
Expose hostname in the web server
1713-
version_added: 1.10.8
1714-
type: string
1715-
example: ~
1716-
default: "False"
17171710
grid_view_sorting_order:
17181711
description: |
17191712
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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,17 @@ config:
6363
access_denied_message:
6464
description: |
6565
The message displayed when a user attempts to execute actions beyond their authorised privileges.
66-
version_added: 2.0.2
66+
version_added: 2.0.3
6767
type: string
6868
example: ~
6969
default: "Access is Denied"
70+
expose_hostname:
71+
description: |
72+
Expose hostname in the web server
73+
version_added: 2.0.3
74+
type: string
75+
example: ~
76+
default: "False"
7077
auth_rate_limited:
7178
description: |
7279
Boolean for enabling rate limiting on authentication endpoints.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ def get_provider_info():
3232
"options": {
3333
"access_denied_message": {
3434
"description": "The message displayed when a user attempts to execute actions beyond their authorised privileges.\n",
35-
"version_added": "2.0.2",
35+
"version_added": "2.0.3",
3636
"type": "string",
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)