Menu

Display Configuration Param in Notification

schirrms
2025-05-15
2025-05-15
  • schirrms

    schirrms - 2025-05-15

    Hi,

    I would like to use some configuration parameters in notification.

    Basically, the idea is to get informations stored in the configuration file (Not in the database) in a notification.

    The reason is that we have one production environment, but some test environments, and we sometime reload the production database in the test environments. But it could be useful to be able to identify the environment in notification.

    I wanted to do tests with the app_env_label params from the config file.

    But I don't find a way to 'extract' a configuration parameter in a notification.

    I tried something like $this->GetConfig()->Get('app_env_label')$ (Also replacing 'this' by 'utils', 'metamodel'…) But this come just out literally (no interpertation at all)

    Is it only possible? If yes, how can I do that? And is there somewhere a documentation stting that?

    Thanks,

    Pascal

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2025-05-15

    "$this" refers to your object in iTop.

    What you seem to be writing, is closer to PHP code (except for the $ at the end). So yeah, it will be quite literal.

    Wouldn't it be easier to just quickly change the email notification(s) to include something to indicate what environment it comes from?

    Or use a different SMTP server/config/mailbox perhaps?

    I don't think there's an easy interface to extend the email notifications and add place holders. But; no one keeps you from creating a custom email action instead.

     
    • schirrms

      schirrms - 2025-05-15

      Hi Jeffrey,

      Thanks for your reply.

      The idea behind this question is not only for mail notifications, but in fact much more for the webhook, to be sure that an database copied from production to test env doesn't "trigger" webkook.

      That's been said, i do suppose that the webhook can reffers to the source URL to discriminate the iTop instance. I just thank that an easy solution was here.

       
  • Stephen Abello

    Stephen Abello - 2025-05-15

    Hi Pascal,

    You could also use the configuration parameter that binds CSS to your notifications, add a bit of HTML that'll be hidden using CSS in your production email / shown in your tests emails to differentiate them

     
    • schirrms

      schirrms - 2025-05-15

      Hi Stephen,

      Thanks for your reply. As I said to Jeffrey, this is not only for mail, I do use notifications to send mail, but also to trigger webhook.

      Well, I'll have to see elsewhere.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.