How to use configure method of Grace IOC for Application Settings - inversion-of-control

I am using Grace and I want to configure it to track my settings in appsettins.json file. I can configure that with default container of ASP.NET Core like the following:
services.Configure<DatabaseConnectionSettings>(this.Configuration.GetSection("Database:Connection"));
and later use the IOptions<DatabaseConnectionSettings> or for reloading capability IOptionsSnapshot<DatabaseConnectionSettings> to get the strong-typed values from the container. How can I achieve this when using Grace? and will it support the reload capability of settings when the underlying data changed?

You can continue configuring your application the exact same way. What ever is registered in the service collection will be registered automatically in Grace. I just created an sample app to test that

Related

WildFly can't use rotating database passwords?

I'm trying to implement a custom credential-store (with custom CredentialStoreSpi implementation) to integrate with data-sources through credential-reference.
The idea is to use a vault service with rotating passwords, and, for now, when I start WildFly, it calls CredentialStoreSpi.retrieve() and initializes data-source with current password, but if I flush data-source and request a new connection there are no calls to .retrieve(). And if I rotate password, then, it fails to create connection with username/password error, and still do not call for a new password.
Looking in specs I see that data-source connection security has a config to some "Reauth Plugin Class Name", but I can't find any clues on what is that.
There is any way to change this behavior and force that any new connection should require password directly from credential-store?
Found this spec: https://docs.wildfly.org/20/wildscribe/subsystem/datasources/data-source/ExampleDS/index.html#attr-reauth-plugin-class-name
reauth-plugin-class-name The fully qualified class name of the reauthentication plugin implementation
Looking at web but find no documentation on this.
Anyone knows what is that? Could it help in this use case?
if the credential store is updated externally you have to do a reload of that credential store. Maybe calling the retrieve method or reloading the credential store in the server at a certain intervals might make sense

Integrating custom kafka consumer with Spring cloud config client

We are using spring config client to refresh properties dynamically. We have added spring-cloud-starter-bus-kafka on the classpath and everything works fine. Pom version of all these dependencies is 2.X.
What I want to do is, remove spring-cloud-starter-bus-kafka and add my custom code to pick up consumer event and refresh context and in turn refresh properties using cloud config client. I believe somewhere Spring is calling ConfigServicePropertySourceLocator.locate. Basically, I want to just replicate what Spring has done in spring-cloud-starter-bus-kafka to make refreshing of properties in real time possible.
The reason I'm doing all this is, I'm internally using an older version of kafka-clients. We have a homegrown version of that, it supports encryption and what not. Problem is coming since spring-cloud-starter-bus-kafka is using 2.X version of kakfa-clients and our home version is not ready for that. Due to this, either one of them is working at one point in time.
Can someone show me some pointer on what needs to be done to consume refresh event from kafka and refresh the property? I don't imagine this being too much complicated. It should be consuming kafka event and somewhere calling ConfigSourceLocator to refresh the properties.
It's even simpler than that. If you look in the RefreshListener class you can see that all it does is
Set<String> keys = this.contextRefresher.refresh();
log.info("Received remote refresh request. Keys refreshed " + keys);
Where contextRefresher is a org.springframework.cloud.context.refresh.ContextRefresher.
This will trigger the code that handles looking up configuration automatically.

Assign names to applications without Service Fabric

I have an application in the service fabric and I'm going to upload another one.
I wonder if it's possible to assign different names to each application.
With an application, I access using the address:
http://sf-spartan.eastus.cloudapp.azure.com
You can configure for access to look like this:?
http://application1.sf-spartan.eastus.cloudapp.azure.com
or
http://sf-spartan.eastus.cloudapp.azure.com/application1
Sure, have a look here. Use the ApplicationName argument to define it.
Every application instance you create must in fact have a unique name.
You can reach your application instance through its url by using a reverse proxy. (either the built-in one, or a custom one like Traefik)
Usually, the application and service name are part of the url, e.g.:
http://mycluster.eastus.cloudapp.azure.com:19081/MyApp/MyService
This does require a web based communication listener.
Event more info here.

Best Practise to provide User-Configuration for an VSTS-Extension

I'm developing a VSTS-Extension which will be executable in the contextmenu of a workitem. I need to provide user-level configuration for the action that is performed by the extension (e.g. which external service should be notified, when performing an action). I'll store the data using the Data-Service provided by the API.
Is there a best-practise to make the configuration available to the user (comparable to the configuration of a dashboard-widget)?
There isn’t the configuration view to config context menu of a work item extension.
You can configure it in a backlog tab page and store the settings for the user by using Data Storage.

Where to store File/Images in Wildfly server?

I am using Wildfly 9.0.2.Final, while in development, all my files that uploaded via my web service and stored in resources/images are gone when I perform a full-publish (luckily this are development dummy images). In production, where is the best place to store or best practice to prevent files/images from missing?
If the files belong somehow to your application, place the somewhere inside the web application (and outside of WEB-INF). They will be accessible through the respective URL path.
If your application needs to store user data that gets uploaded dynamically during application runtime and shall persist even if you redeploy the application, then you better have a configurable directory on disk. One default option to find the JBoss/Wildfly data directory could be to query for the system property 'jboss.server.data.dir'.