Access Azure app variables in spring application.properties - spring

Is is possible to access Azzure app settings variables in spring boot application.properties?
Azzure app settings variables
like this?
application.properties

Related

programmatically configuration for spring boot micrometer with influxdb

I am facing some challenges while configuring Spring Boot Micrometer for my application. Micrometer documents says we can configure influxdb uri, userName, password, db etc through application.yml file which is working fine for my demo application but for production ready application we are using docker-compose and we are setting all our environment variable through docker-compose. Now I am facing challenges like -
How can I force micrometer to use docker-compose environment variable influxdb uri
For influxdb password, our application stores passwords in AWS secret Manager, how micrometer will access password from secret manager?
Can I configure all this micrometer properties programmatically (Spring Bean)? How?
I'm not sure how to leverage AWS Secret Manager, but for point 1 and 3 I can offer some advice.
I'm not familiar with Influx specifically, but based on the javadoc it uses management.metrics.export.influx.username to set the password.
1- To set a application property via an environment variable, set the equivalent using the typical 'SCREAMING_SNAKE_CASE' format:
MANAGEMENT_METRICS_EXPORT_INFLUX_USERNAME=myInfluxUser
Or if you already have an environment variable that you want to reference in you application.yml file you con reference in as a property:
management.metrics.export.influx.username: ${INFLUX_USER}
3- To configure Micromerter/influx programatically create a bean on type InfluxProperties:
#Bean
public InfluxProperties influxProperties() {
return new InfluxProperties(); // Programatically set any properties here.
}

How can I read all users using keycloak and spring in openshift?

here i am trying to get a list with users from keycloak.
it works withe docker compose, but not in openshift?!
my application.property
keycloak.enabled=true
keycloak.realm=somname
keycloak.ssl-required=none
keycloak.resource=someapp
keycloak.public-client=true
keycloak.auth-server-url=${KEYCLOAK_AUTH-SERVER-URL:https://localhost/auth}
keycloak.disable-trust-manager=true
app.connectors.KeyCloakAdminConnector.serverUri=${KEYCLOAK_ADMIN-URL:http://idm.local:8081/auth}
app.connectors.KeyCloakAdminConnector.realm=${keycloak.realm}
app.connectors.KeyCloakAdminConnector.username=admin
app.connectors.KeyCloakAdminConnector.password=pass
app.connectors.KeyCloakAdminConnector.clientId=${keycloak.resource}
As a solution i changed the:
keycloak-admin-url: 'my-keycloak-route/auth'
in application.property to
keycloak-admin-url: 'http://myservice-keycloak-http:8080/auth'
so i change the connection between the Spring boot App and Keycloack from Rout-Object to a Service-Object.
its works because Service is not https. so i dont need to provide a certificate to JVM keytrust in the Spring boot App

How to protect Spring boot application with keycloak Gatekeeper?

I have a spring boot application and I need to protect it with the keycloak gatekeeper. Should I configure the properties file or just add the gatekeeper config file in the application? Or should I have the gatekeeper config file separately? Are there any configurations to be made in keycloak admin console?

Google app engine flexible not load context path of Spring boot application

I have spring boot application and already deploy on GAE Flexible env.
In my application, I already set my application context path in application.properties file look like:
server.context-path=/myapp
And it work fine on tomcat and jetty embedded server.
But when I deploy to GAE flex env my application not work with context path that I already set on my application.properties file.
It auto use context path "/" in GAE domain.
Because I'm using dispatch to defined routing on GAE with multi microservice, so I have to define a specify context path for each service.
Anybody can help me in this case?
Thanks.

spring cloud config client set config url at property file

I have a spring cloud project. There are config server (config-srv), eureka server (eureka-srv) and some other service with business logic, let's call it main service (main-srv).
I'm packaging them into jars and run one by one. My apps get their properties from a file in the same directory with jars.
So, I'm setting properties to config-srv through "application-native.properties".
But if i want to change config-srv url (for example, i want http://localhost:9999), how can i share this url for all micro-services before they will boot ? I'm trying to share this url in "application-default.properties" but it makes no effect.
You can put the Spring Cloud Config server details in bootstrap.properties file in each microservices.
spring.application.name=microserviceName
spring.profiles.active=dev
spring.cloud.config.uri=http://localhost:9999
spring.cloud.config.username=your_username
spring.cloud.config.password=your_password
Go through the link to have more detail about spring cloud config
https://howtodoinjava.com/spring-cloud/spring-cloud-config-server-git/

Resources