how to set application property variable with system eviroment - spring-boot

I need to set applcation properties variable with system variable Ex.
my system variable enviroment on widows is USER_NAME = admin
I want that set spring.datasource.username with USER_NAME
I tryed to do this mode:
in application.properties file
spring.datasource.username={USER_NAME}
but dind't set.
anybody knows how to do?

In your application properties the values should be with lower case and separated by point:
spring.datasource.username=${user.name}
Your environment variable should be as you've mentioned:
USER_NAME=admin

Related

How to set enviroment variable Heroku

I need to set enviroment variable GOOGLE_APPLICATION_CREDENTIALS at .json format like service-account-file.json but i cant.
I tried this https://elements.heroku.com/buildpacks/buyersight/heroku-google-application-credentials-buildpack and this https://github.com/gerywahyunugraha/heroku-google-application-credentials-buildpack but it is not working.Heroku => java.io.IOException: Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS, value 'google-credentials.json': File does not exist.
There is no such ways to set environment variable from json file you can use the environment variable like process.env.VARIABLENAME and define that variable name in config
Here i attach the screenshots from where you can define the variable

How to set Fileinput directory value from properties?

If my flow is File Input -> Compute Node -> File Output, how can I set the File Input directory value based on a User Defined Property? I will have a different file drop directory for dev, qa and prod and don’t want this hard coded anywhere. If it cannot be done using my User Defined Properties, how else can I accomplish this?
Create configurable properties per environment and define the input directory there.
Properties for dev:
# File: yourapp-dev.properties
yourflow#File Input.inputDirectory = ./yourapp/dev/in
Properties for qa:
# File: yourapp-qa.properties
yourflow#File Input.inputDirectory = ./yourapp/qa/in
Apply the properties per environment. For dev it would be:
mqsiapplybaroverride -b yourapp.bar -p yourapp-dev.properties -r
Now you can deploy yourapp.bar to the dev environment.

Set local_tmp as an ansible variable

Is it possible to set local_tmp as a variable in a playbook or pass it on the command-line instead? The only way, as I see it, to set this variable is by writing it to a file in a pre-determined location or by creating the file in an arbitrary location and setting the environment variable ANSIBLE_CONFIG to point to it.
What I want is to overrirde the default value of local_tmp by specifying it on either the command-line or in a playbook.
You can do:
ANSIBLE_LOCAL_TEMP=/tmp/.ansible/tmp ansible-playbook myplaybook.yml

how do I get the value of an environment variable in Applescript?

Specifically, I need to retrieve the value of the current user's HOME variable. But I would prefer that the answers be generically applicable to any environment variable.
system attribute "HOME" retrieves the value of environment variable HOME.
The mechanism works generically:
set envVarName to "SHELL" # sample variable name
system attribute envVarName # returns, e.g., "/bin/bash"

Get SYSTEM temp folder?

I'm looking for something similar to this question. However, I am looking specifically to dynamically find the location of the system's temp folder (i.e. the temp folder used by services.)
Is this possible?
Thanks,
Here you go (in VBS)
Set environmentVars = WScript.CreateObject("WScript.Shell").Environment("Process")
tempFolder = environmentVars("TEMP")
msgbox(tempFolder)
I'm not sure if your system will have an environment variable called "TEMP", so go to the command line and type
set
You'll get a list of environment vars, and their values. Pick the one that has your temp folder in it.
Set objShell = CreateObject("WScript.Shell")
Set colEnvironment = objShell.Environment("PROCESS")
objPath = colEnvironment("temp")
WScript.Echo objPath
In that case
Set objShell = CreateObject("WScript.Shell")
Set colEnvironment = objShell.Environment("PROCESS")
objPath = colEnvironment("windir")
WScript.Echo objPath & "\temp"
hope this will help
After researching a little into this, I believe there is no way to use environment variables to capture the location of another user's %TEMP% folder (in this case the System user).
The SYSTEM environment variables is stored in registry key: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment
The environment variables for users is stored in registry keys: HKEY_USERS[user SID]\Environment
In order to get the value of any environment variable (in particular TEMP), need to check the presence of this variable in the branch for specified the user. If it is there, then you can use it. If it is not there, then you need to take a value from the system registry branch.
In C#, its...
System.Collections.IDictionary Vars = System.Environment.GetEnvironmentVariables();
String TempPath = Vars["TEMP"];
You get an entire array of elements... Path, Temp, SessionName, PathExt, UserDomain, SystemDrive, WinDir, etc...
Maybe this may be of some use: System.IO.Path.GetTempPath()

Resources