Commit ea9466aa authored by Elias Häußler's avatar Elias Häußler 🐛

[FEATURE] Add environment variable `SERVER_NAME`

parent ab824f0c
......@@ -10,4 +10,5 @@ DEBUG_EXCEPTIONS=0
MINIMUM_LOG_LEVEL=1
# Route settings
SERVER_NAME=
ROUTE_BLACKLIST=favicon.ico
......@@ -6,6 +6,10 @@ Version numbers are based on [Semantic Versioning](https://semver.org).
## [Unreleased]
### Added
- Environment variable `SERVER_NAME`
### Updated
- Build documentation only for committed files in pre-commit hook
......
......@@ -231,7 +231,11 @@ class SlackController extends BaseController
*/
public function buildAttachmentFooter(): string
{
return "api.elias-haeussler.de | " . ConsoleUtility::describeHistory(ConsoleUtility::HISTORY_TYPE_VERSION);
return sprintf(
"%s | %s",
GeneralUtility::getServerName(),
ConsoleUtility::describeHistory(ConsoleUtility::HISTORY_TYPE_VERSION)
);
}
/**
......
......@@ -159,6 +159,19 @@ class GeneralUtility
return implode("", preg_split("/Controller$/", $controller, -1, PREG_SPLIT_NO_EMPTY));
}
/**
* Get current server name from environment variable or server.
*
* Returns the server name by reading the appropriate environment variable. If it is not set,
* the default server name, provided by the server itself, will be returned.
*
* @return string The current server name
*/
public static function getServerName(): string
{
return self::getEnvironmentVariable("SERVER_NAME", $_SERVER['HTTP_HOST']);
}
/**
* Load API environment.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment