prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Distinguish between staging & prod when sending data refresh slack updates
  ## Problem
  <!-- Describe a problem solved by this feature; or delete the section entirely. -->
  It's not easy to tell based on the slack messages produced by the ingestion server whether a given ingestion is being run in production or staging.
  
  ## Description
  <!-- Describe the feature and how it solves the problem. -->
  We should pre-pend the messages (or change the bot's name) based on which environment the data refresh is running in. 
  
  ## Alternatives
  <!-- Describe any alternative solutions or features you have considered. How is this feature better? -->
  We _could_ turn off messages altogether for staging (how it is currently) but that would make it harder for us to know when a staging data refresh is complete.
  
  ## Additional context
  <!-- Add any other context about the feature here; or delete the section entirely. -->
  
  ## Implementation
  <!-- Replace the [ ] with [x] to check the box. -->
  - [x] 🙋 I would be interested in implementing this feature.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `ingestion_server/ingestion_server/slack.py`
  Content:
  ```
  1 import logging
  2 import os
  3 
  4 import requests
  5 
  6 
  7 log = logging.getLogger(__name__)
  8 SLACK_WEBHOOK = "SLACK_WEBHOOK"
  9 
  10 
  11 def message(text: str, summary: str = None) -> None:
  12     """
  13     Send a Slack message to a channel specified by a Slack webhook variable.
  14 
  15     A message is only sent if the SLACK_WEBHOOK environment variable is undefined.
  16     """
  17     if not (webhook := os.getenv(SLACK_WEBHOOK)):
  18         log.debug(
  19             f"{SLACK_WEBHOOK} variable not defined, skipping slack message: {text}"
  20         )
  21         return
  22     if not summary:
  23         if "\n" in text:
  24             summary = "Ingestion server message"
  25         else:
  26             summary = text
  27 
  28     data = {
  29         "blocks": [{"text": {"text": text, "type": "mrkdwn"}, "type": "section"}],
  30         "text": summary,
  31         "username": "Data Refresh Notification",
  32         "icon_emoji": "arrows_counterclockwise",
  33     }
  34     try:
  35         requests.post(webhook, json=data)
  36     except Exception as err:
  37         log.exception(f"Unable to issue slack message: {err}")
  38         pass
  39
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/ingestion_server/ingestion_server/slack.py b/ingestion_server/ingestion_server/slack.py
  --- a/ingestion_server/ingestion_server/slack.py
  +++ b/ingestion_server/ingestion_server/slack.py
  @@ -2,6 +2,7 @@
   import os
   
   import requests
  +from decouple import config
   
   
   log = logging.getLogger(__name__)
  @@ -25,10 +26,12 @@
           else:
               summary = text
   
  +    environment = config("ENVIRONMENT", default="local")
  +
       data = {
           "blocks": [{"text": {"text": text, "type": "mrkdwn"}, "type": "section"}],
           "text": summary,
  -        "username": "Data Refresh Notification",
  +        "username": f"Data Refresh Notification | {environment.upper()}",
           "icon_emoji": "arrows_counterclockwise",
       }
       try:
  
verification_info: {"golden_diff": "diff --git a/ingestion_server/ingestion_server/slack.py b/ingestion_server/ingestion_server/slack.py\n--- a/ingestion_server/ingestion_server/slack.py\n+++ b/ingestion_server/ingestion_server/slack.py\n@@ -2,6 +2,7 @@\n import os\n \n import requests\n+from decouple import config\n \n \n log = logging.getLogger(__name__)\n@@ -25,10 +26,12 @@\n         else:\n             summary = text\n \n+    environment = config(\"ENVIRONMENT\", default=\"local\")\n+\n     data = {\n         \"blocks\": [{\"text\": {\"text\": text, \"type\": \"mrkdwn\"}, \"type\": \"section\"}],\n         \"text\": summary,\n-        \"username\": \"Data Refresh Notification\",\n+        \"username\": f\"Data Refresh Notification | {environment.upper()}\",\n         \"icon_emoji\": \"arrows_counterclockwise\",\n     }\n     try:\n", "issue": "Distinguish between staging & prod when sending data refresh slack updates\n## Problem\r\n<!-- Describe a problem solved by this feature; or delete the section entirely. -->\r\nIt's not easy to tell based on the slack messages produced by the ingestion server whether a given ingestion is being run in production or staging.\r\n\r\n## Description\r\n<!-- Describe the feature and how it solves the problem. -->\r\nWe should pre-pend the messages (or change the bot's name) based on which environment the data refresh is running in. \r\n\r\n## Alternatives\r\n<!-- Describe any alternative solutions or features you have considered. How is this feature better? -->\r\nWe _could_ turn off messages altogether for staging (how it is currently) but that would make it harder for us to know when a staging data refresh is complete.\r\n\r\n## Additional context\r\n<!-- Add any other context about the feature here; or delete the section entirely. -->\r\n\r\n## Implementation\r\n<!-- Replace the [ ] with [x] to check the box. -->\r\n- [x] \ud83d\ude4b I would be interested in implementing this feature.\r\n\n", "before_files": [{"content": "import logging\nimport os\n\nimport requests\n\n\nlog = logging.getLogger(__name__)\nSLACK_WEBHOOK = \"SLACK_WEBHOOK\"\n\n\ndef message(text: str, summary: str = None) -> None:\n    \"\"\"\n    Send a Slack message to a channel specified by a Slack webhook variable.\n\n    A message is only sent if the SLACK_WEBHOOK environment variable is undefined.\n    \"\"\"\n    if not (webhook := os.getenv(SLACK_WEBHOOK)):\n        log.debug(\n            f\"{SLACK_WEBHOOK} variable not defined, skipping slack message: {text}\"\n        )\n        return\n    if not summary:\n        if \"\\n\" in text:\n            summary = \"Ingestion server message\"\n        else:\n            summary = text\n\n    data = {\n        \"blocks\": [{\"text\": {\"text\": text, \"type\": \"mrkdwn\"}, \"type\": \"section\"}],\n        \"text\": summary,\n        \"username\": \"Data Refresh Notification\",\n        \"icon_emoji\": \"arrows_counterclockwise\",\n    }\n    try:\n        requests.post(webhook, json=data)\n    except Exception as err:\n        log.exception(f\"Unable to issue slack message: {err}\")\n        pass\n", "path": "ingestion_server/ingestion_server/slack.py"}], "after_files": [{"content": "import logging\nimport os\n\nimport requests\nfrom decouple import config\n\n\nlog = logging.getLogger(__name__)\nSLACK_WEBHOOK = \"SLACK_WEBHOOK\"\n\n\ndef message(text: str, summary: str = None) -> None:\n    \"\"\"\n    Send a Slack message to a channel specified by a Slack webhook variable.\n\n    A message is only sent if the SLACK_WEBHOOK environment variable is undefined.\n    \"\"\"\n    if not (webhook := os.getenv(SLACK_WEBHOOK)):\n        log.debug(\n            f\"{SLACK_WEBHOOK} variable not defined, skipping slack message: {text}\"\n        )\n        return\n    if not summary:\n        if \"\\n\" in text:\n            summary = \"Ingestion server message\"\n        else:\n            summary = text\n\n    environment = config(\"ENVIRONMENT\", default=\"local\")\n\n    data = {\n        \"blocks\": [{\"text\": {\"text\": text, \"type\": \"mrkdwn\"}, \"type\": \"section\"}],\n        \"text\": summary,\n        \"username\": f\"Data Refresh Notification | {environment.upper()}\",\n        \"icon_emoji\": \"arrows_counterclockwise\",\n    }\n    try:\n        requests.post(webhook, json=data)\n    except Exception as err:\n        log.exception(f\"Unable to issue slack message: {err}\")\n        pass\n", "path": "ingestion_server/ingestion_server/slack.py"}]}