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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
"$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.
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.
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
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.