38.7. Customizing Git hook notifications
Business Central provides a mechanism that enables users to receive customized Git hook notifications based on the hook exit codes.
To enable the notification mechanism you must create a *.properties file containing the custom messages and then specify the path to that file as the value of the appformer.git.hooks.bundle system property.
Procedure
Create the
*.propertiesfile and add a line for each exit code with a corresponding message in the following format:<exit_code>=<display_message>The
<exit_code>is the Git hook exit code and the<display_message>is the custom message that is displayed to a user.For example:
0=Success! All working as expected. 1=Warning! Please check the logs and advise your admin. . . 31=Error! Please advise your admin immediately.注記It is not necessary to define all the possible exit codes in the *.properties file. Notifications appear only for the exit codes defined in the *.properties file.
重要The notification service only supports the
ISO 8859-1(LATIN 1) character set in the properties file. If you want to use extended characters, please use their escaped Unicode character code sequences.To enable Git hook notifications, specify the path to the file as the value of the
appformer.git.hooks.bundlesystem property.See the following example of a
standalone.xmlfile with the setting that points to aMessages.propertiesfile:<system-properties> <property name="appformer.git.hooks.bundle" value="/opt/jboss-as/git-hooks-messages/Messages.properties"> </property> ... </system-properties>
38.7.1. Git hook notifications in Business Central リンクのコピーリンクがクリップボードにコピーされました!
You can view Git hook notifications in Business Central. There are three Git hook exit code notification types.
| Exit code | Customized message | UI notification color |
|---|---|---|
|
| Success! All working as expected. | Green |
|
| Warning! Please check the logs and advise your admin. | Orange |
|
| Error! Please advise your admin immediately. | Red |
UNIX machines only support error codes between 0 (success) to 255 (error), any exit code outside of this range will end up being converted into a different code which may cause showing a wrong notification message.
Windows machines don’t have this limitation and support a wide range of exit codes.
38.7.2. Git hook notification internationalization support リンクのコピーリンクがクリップボードにコピーされました!
You can internationalize notification messages by placing additional properties files in the same path as the original properties file specified as the appformer.git.hooks.bundle system property.
The name of the different localized files must be <filename>_<lang>.properties, where the <filename> is the same as the original. For example, where the system property points to Messages.properties, you can create Messages_en.properties for English, Messages_fr.properties for French, or Messages_it.properties for Italian.
The notification service will choose the properties file based on the user’s language, if there are no available translations for that language it will use the entries from the original Messages.properties file.