Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not get values from appsettings.json #2

Closed
NeoKendall opened this issue Feb 2, 2021 · 11 comments · Fixed by #4
Closed

Can not get values from appsettings.json #2

NeoKendall opened this issue Feb 2, 2021 · 11 comments · Fixed by #4
Labels
enhancement New feature or request
Milestone

Comments

@NeoKendall
Copy link

Hello!

I declared a variable:
<variable name="teamsUrl" value="${configsetting:name=Logging.TeamsUrl}"/>

and then i used it like this:

<target xsi:type="MsTeams"
        name="teams"
        Url="${teamsUrl}"
        ApplicationName="ApplicationName"
        Environment="dev"/>

But it doesn't work.
Is it possible to use values from appsettings.json?

@cbolandK20
Copy link
Collaborator

This matter is more NLog related, but that's possible.
I haven't tried it, but the NLog Documatation says: yes
See this posts for a how to:
NLog/NLog.Extensions.Logging#263
and
https://stackoverflow.com/questions/56246416/how-can-i-configure-nlog-in-net-core-with-appsettings-json-instead-of-an-nlog-c

@NeoKendall
Copy link
Author

Yes, it works for other targets, but not for this.
Even if I use json configuration and specify name using ${configsetting:item=Logging.ApplicationName}, I just get the same string in the application name field on card, not the value from the config. But for default target it works.

@cbolandK20
Copy link
Collaborator

ok, I will reopen the Issue und have a look. Maybe you could create a branch and modify the test App according to your setup so that I can check it more easily?
Please do not enter your Teams Webhook URL in this branch - I will use mine ;-)

@cbolandK20 cbolandK20 reopened this Feb 3, 2021
@NeoKendall
Copy link
Author

I created test app, but I don't have permissions to push. Could you please provide them?

@cbolandK20
Copy link
Collaborator

I looks that you forked the whole repo. Can you push to your fork?
I thought more about a feature branch or similar. Maybe I can pull your fork.

@NeoKendall
Copy link
Author

I also don't work with github often:)
I pushed to my fork. Look at this please.

@cbolandK20
Copy link
Collaborator

Thanks, I looking into it

@cbolandK20
Copy link
Collaborator

Right now this is unfortunately not supported - BUT ...
I'm working on a 2.0 Version (with easier custom message cards) and will add this feature

@snakefoot
Copy link
Contributor

Created #4 that adds Layout-support of Application + Environment + Url

@cbolandK20 cbolandK20 added enhancement New feature or request in progress in the works right now labels Feb 5, 2021
@NeoKendall
Copy link
Author

Right now this is unfortunately not supported - BUT ...
I'm working on a 2.0 Version (with easier custom message cards) and will add this feature

Thanks!

@cbolandK20 cbolandK20 added this to the v2.0.0 milestone Feb 5, 2021
@cbolandK20
Copy link
Collaborator

cbolandK20 commented Feb 6, 2021

Version 2.0.0 is out on nuget. Thanks

@cbolandK20 cbolandK20 removed the in progress in the works right now label Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants