Using environmental variable in rabbitmq.conf file - windows

I am using RabbitMQ in windows environment. I am using RabbitMQ with ssl configuration.
My requirement is to use environment variable in the rabbitmq.conf file to read SSL certificates. I have used it as below,
{cacertfile, "${MY_HOME}/config/SSLCertificates/testca/cacert.pem"
The above usage of environmental variable doesnt work. Can any one of you please help me in correct usage of environmental variable.

Try adding your variables to file rabbitmq-env.bat from the docs that's the location in windows:
If rabbitmq-env.conf doesn't exist, it can be created manually in the location, specified by the RABBITMQ_CONF_ENV_FILE variable. On Windows systems, it is named rabbitmq-env.bat.
Also, you may need to use %% instead of ${} since you are in windows.
From the windows section
If you need to customise names, ports, locations, it is easiest to configure environment variables in the Windows dialogue: Start > Settings > Control Panel > System > Advanced > Environment Variables.
So after defining your environments, try this:
...
{cacertfile, "%YOURVAR%\path\to\cacert.pem"}
...
Windows: %APPDATA%\RabbitMQ

Related

How to enable NetBeans 15 for Mac honour the system environment variables with Gradle builds

I have recently started to use GitHub Packages to distribute our shared libraries internally and have retrospectively changed the Gradle build configuration to use credentials based on system environment variables, rather than hard-coded e.g.
repositories {
mavenLocal() // only use when testing -SNAPSHOT locally
mavenCentral() // third-parties
maven { // our-library
name = "MyLibrary"
url = "https://maven.pkg.github.com/MyCompany/mylibrary"
credentials {
username = project.findProperty("git_username") ?: System.getenv("git_username")
password = project.findProperty("git_token") ?: System.getenv("git_token")
}
}
}
Unfortunately no matter how many environment variables I changed, whether in ~/.zshrc or .zshenv or .bash_profile or /etc/launchd.conf the build was indicating that the credentials were prohibited, or more accurately were resolved as nul.
Each time I changed a config I also ran the appropriate source to ensure it was active, I even resorted to rebooting, just in case.
The environment variable would always show in the terminal confirming the environment variable was always set up correctly, e.g. echo $git_username or printenv yielded the environment variable and expected sensitive token.
After a lot of experimenting and with the help of a colleague we determined that launching NetBeans 15 from the dock wasn't helping, so instead we also added the following line to ~/.zshrc
alias netbeans="/Applications/NetBeans/Apache\ NetBeans\ 15.app/Contents/MacOS/netbeans &"
But now to launch NetBeans I can't use the dock icon, but manually launch the terminal and then type
netbeans
Here's the new lines added to ~/.zshrc
#
# RW - For GitHub Package access
#
export git_username=NotApplicableUsesToken
export git_token=redacted1
export git_publish_username=NotApplicableUsesToken
export git_publish_token=redacted2
#
# RW - So Netbeans launches and honours the environment variables above
#
alias netbeans="/Applications/NetBeans/Apache\ NetBeans\ 15.app/Contents/MacOS/netbeans &"
My question is, why didn't NetBeans when launched from the dock discover the environment variables? How should I configure NetBeans to pickup the environment variables without this workaround?
The Aqua GUI doesn't read any of the shell configuration files, e.g. .bash_profile, .bashrc, .login, .profile, .zprofile, or .zshrc. You were correct to start looking at launchd. Unfortunately /etc/launchd.conf is no longer supported and the file is not read.
Apple's Runtime Configuration Guidelines in the Environment Variables section states:
There are two ways to make environment variables available to an application. The first is to define the variables in a Terminal session and then launch the application from the same session. ...
The second way to associate environment variables with an application is to include the LSEnvironment key in the application’s information property list file. ...
Editing an application's plist doesn't seem like the best idea and your changes may be lost when the application is updated.
There is a third approach.
launchctl has setenv, unsetenv, and getenv sub-commands for managing environment variables. However the environment variables are not persisted across launchd instances.
It seems that a common approach is to create an agent job .plist in ~/Library/LaunchAgents that runs at user login to macOS that will execute launchctl setenv to set the environment variables that should be available to applications launched from the dock. There are discussions at "Set systemwide variable with /etc/launchd.conf does not work in 10.10" and "Environment variables for GUI apps" that point to resources for this approach. You may also want to see Creating Launch Daemons and Agents.
I haven't tested or tried this approach myself.

How to use environment variables in prisma

From this document, Prisma cli try to download binaries from prisma s3. But as my corporate firewall rules this download was blocked, Following this document,I must change source binary file location by using PRISMA_ENGINES_MIRROR variable.
to utilize this variable,I must set environment variables. my build environment is like ElasticBeanstalk,after git push, build will start. from now on,I couldn't configure env variables in build environment. so that I consider to configure and write PRISMA_ENGINES_MIRROR variable to .env files and push them.
Is it possible? and how can I utilize these variable by .env ?
If someone has opinion,please let me know.
Thanks
You can configure environment variables in Elastic BeanStalk by going to
Configuration > Software Configuration > Environment Properties
You can add PRISMA_ENGINES_MIRROR in Environment Properties and it will be picked up by .env

Jmeter_home environment variable is not defined correctly in Jenkins only ,works fine with cmd prompt

I am trying to integrate jmeter with Jenkins and when I try to execute getting jmeter_home env variable, is not defined correctly. It works perfectly when try to execute through the command prompt.
Tried multiple options of setting jmeter_home in Jenkins config global as ~/.jmeter.
Changing jmeter path in system and through a couple of options but no luck.
The environment variable name is case-sensitive, it needs to be JMETER_HOME
Tilda resolves to $HOME environment variable in shell, it might be the case it isn't set so in that case you might want to use full path or check your OS configuration
In general as per JMETER_HOME variable description
(Optional) May point to your JMeter install dir. If empty
it will be set relativ to this script.
So you don't have to pass it, JMeter will "guess" its home from the jmeter starup script location
Also remember that you can always launch JMeter .jar file directly as:
java -jar /path/to/ApacheJMeter.jar
And last but not the least you may find Continuous Integration 101: How to Run JMeter With Jenkins article useful

how to change config server uri dynamically using OS environment

I have a spring config server and spring config client. In client I have set spring.cloud.config.uri to http://localhost:8888 but I want to change it to some other uri say http://example.com:8888 in windows using OS environment with setx. so I ran
setx spring.cloud.config.uri "http://example.com:8888"
but when I run my spring config client it's still trying to read from localhost . As per this link my spring.cloud.config.uri in bootstrap.yml should get override by what i set with OS environment but it didn't. Please let me know what I am doing wrong here.
setx
setx adds the variable but doesn't make it available in the current shell (as explained here):
setx modifies the value permenantly, which affects all future shells,
but does not modify the environment of the shells already running. You
have to exit the shell and reopen it before the change will be
available, but the value will remain modified until you change it
again.
Just make sure you are runnning from a newly opened shell window.
I suggest you use set spring.cloud.config.uri=http://example.com:8888 just for the sake of testing.
Check if the environment variable is present
You may add the following as the very first line your main method:
System.out.println(System.getenv("spring.cloud.config.uri"));
System.out.println(System.getenv("SPRING_CLOUD_CONFIG_URI"));
Variable name with underscore
Windows supports environment variables with dots, so it should be ok for you. This isnt the case for pretty much all the other OS. Just so you know, spring supports variable name with underscores (as explained in the link you provided):
If you use environment variables rather than system properties, most
operating systems disallow period-separated key names, but you can use
underscores instead (e.g. SPRING_CONFIG_NAME instead of
spring.config.name).

Is it possible to change TeamCity's artifacts path

The default path for teamcity artifacts is
C:\#User#\.BuildServer\system\artifacts
How can i change it to
d:\TeamCity\Artifacts
Thanks
For me the default is D:\BuildServer\system\artifacts
Yes you can, set the TEAMCITY_DATA_PATH environment variable.
See here: http://www.jetbrains.net/confluence/display/TCD4/TeamCity+Data+Directory
By default, the is placed in the user's
home directory (e.g. it is
$HOME/.BuildServer under Linux and
C:\Documents and
Settings\.BuildServer)
under Windows. Alternatively, you can
define this directory in one of the
following ways:
As a Tomcat system property teamcity.data.path (see System
Properties for Running the Server)
In the TEAMCITY_DATA_PATH environment variable (this will be
used if the teamcity.data.path JVM
system property is not found)

Resources