Skip to content

Commit

Permalink
fix: tell type checkers that the config options are strings (#322)
Browse files Browse the repository at this point in the history
* Tell type checkers that the config options are strings.

* Fix formatting.
  • Loading branch information
tonyandrewmeyer authored Apr 11, 2024
1 parent 3a0706a commit 7bd93a1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,15 +1033,17 @@ def _build_layer(self) -> Layer:
"startup": "enabled",
"environment": {
"GF_SERVER_HTTP_PORT": str(PORT),
"GF_LOG_LEVEL": self.model.config["log_level"],
"GF_LOG_LEVEL": cast(str, self.model.config["log_level"]),
"GF_PLUGINS_ENABLE_ALPHA": "true",
"GF_PATHS_PROVISIONING": PROVISIONING_PATH,
"GF_SECURITY_ALLOW_EMBEDDING": self.model.config["allow_embedding"],
"GF_SECURITY_ADMIN_USER": self.model.config["admin_user"],
"GF_SECURITY_ALLOW_EMBEDDING": cast(
str, self.model.config["allow_embedding"]
),
"GF_SECURITY_ADMIN_USER": cast(str, self.model.config["admin_user"]),
"GF_SECURITY_ADMIN_PASSWORD": self._get_admin_password(),
"GF_AUTH_ANONYMOUS_ENABLED": self.model.config[
"allow_anonymous_access"
],
"GF_AUTH_ANONYMOUS_ENABLED": cast(
str, self.model.config["allow_anonymous_access"]
),
"GF_USERS_AUTO_ASSIGN_ORG": str(
self.model.config["enable_auto_assign_org"]
),
Expand Down Expand Up @@ -1203,7 +1205,7 @@ def _on_get_admin_password(self, event: ActionEvent) -> None:

try:
pw_changed = self.grafana_service.password_has_been_changed(
self.model.config["admin_user"], self._get_admin_password()
cast(str, self.model.config["admin_user"]), self._get_admin_password()
)
except GrafanaCommError as e:
event.fail(f"Grafana is not reachable yet: {e}. Please try again in a few minutes.")
Expand Down

0 comments on commit 7bd93a1

Please sign in to comment.