passing command line properties on OpenFire startup - openfire

I need to pass some command line properties that could be read by a plugin. I looked around and did not see anything.
I would rather do it this way that in the admin console. It would be a single property.
Or, .... If I can pass a configuration file that I might customize that could be available to a plugin.
So is there a way?

Related

How to temporarily change a setting in VSCode

When I am editing a standalone Python file in VSCode (not part of a workspace) I will often need to alter the value of python.pythonPath to reflect a specific virtualenv I am using to run that code.
As the setting is just for the one file, I don't want to change my persistent global settings, and I don't have workspace settings. Is there a way to change a setting just for this session? (Ideally, just for this one file, but I don't expect that to be possible, so I'd be happy with "just for the session"). If there isn't a built in way to do this, is there an extension which allows this? Or even an extension API that I could use to write my own extension for this?
As an alternative, is there a way to use an environment variable in a setting, and then set that environment variable for the current VSCode process? That would have the same effect, it would just require me to set up my user settings specifically to allow this usage.
If you launch vscode from the terminal after having activated your virtualenv, vscode will automatically use the aforementioned virtualenv (with no modification to your settings):
Exemple:
source venv/bin/activate
code .
Note: if vscode is already opened, use code -n . in order to open the file/folder in a new window.

IntelliJ IDEA global environment variable configuration

I need to use an envirnoment variable in all of my idea run configurations. I currently use run->edit configurations->and then enter the env variables in selected configuration. However that's very tedious when I need to run isolated test scenarios because each one creates a new run configuration and I need to enter the variables all over again.
I tried to set the env variables in my linux system using export SOME_VAR="some value" in various session profile files: /etc/profile,/etc/bash.bashrc,~/.bashrc,~/.profile but intellij seems to ignore those vars during run, even though when I launch echo ${SOME_VAR} from intellij built-in terminal it displays the correct output.
I also tried using intellij .env file plugin and then set SOME_VAR=some value in .env file in project root. Didn't work either.
I found a solution to set environment variables on IntelliJ that has been working very well for me, and is incredibly simple. Let me show you.
This is the program (you can copy and paste it) we're using to test:
package com.javasd.intelijenv;
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<String, String> env = System.getenv();
for (String envName : env.keySet()) {
System.out.format("%s=%s%n", envName, env.get(envName));
}
System.out.println("My home directory: " + System.getenv("MY_VAR"));
}
}
This program basically loads all environment variables, show them on the console, and try to show an env variable. Also, it assumes that you had created the MY_VAR env variable before calling IntelliJ IDEA, by doing something like:
$ export MY_VAR="This is my adorable var :)"
$ idea
Please, notice that we're calling IntelliJ IDEA in the same terminal (or session, or window) where we created the environment variable. If you create the variable and call the IDEA from the icon, the solution won't work because the IDEA will create its own session.
So, if run it without the correct configuration you will get something line this in your console:
Please, notice that you have just a few variables, and that MY_VAR is null.
Here's configuration I use to load the environment variables:
Click on the "Select Run/Debug Configurations" in your project and select "Edit Configurations":
Then, click on the the button with "..." on the right side of the "Environment Variables" section:
You'll see a pop-up. Check the checkbox on the bottom-left which has the label "Include parent environment variables":
That's it!!!
If you run your program now you will see something like this on your console:
You can see all the environment variables and, of course, your "MY_VAR" variable, with the right value!
Beyond the Basics
Usually, for security reasons, we don't want to keep all the environment variables visible. What we want to do is to make those variables visible only while the IntelliJ (or our program) is running.
So, no sensitive variables should be visible on the environment neither before you call Intellij nor after you close it.
Also, you want to keep those variables in a file (typically with a .env extension) to make it easy to manipulate and for security reasons.
To achieve this, there are some useful programs (you can Google them), but my favorite one is the env-cmd.
Let's say you have a test.env file with the following content:
MY_TEST_VAR=I live in the test.env file.
If you call IntelliJ by doing this:
$ env-cmd test.env idea
And edit your program to show "MY_TEST_VAR", and run it, you will see this on the IntelliJ's console:
But if you quit the IntelliJ, and look for your variable, you will see that the var doesn't exist (you can use env to confirm):
At this point, I hope you're able to play with your own solutions: create shell scripts with variables set inside, test other programs (direnv, autoenv, etc.), and so on.
Enjoy!
...
In my opinion the real issue is what Mat said.
If you want to launch IntelliJ from a shortcut, then you have to edit it a little bit:
Open the .desktop file, and add /bin/bash -c -i to the beginning of the launch command. The file should look something like this:
[Desktop Entry]
Exec=/bin/bash -i -c "/path/to/idea/bin/idea.sh" %f
Name=IntelliJ IDEA Ultimate
Type=Application
Version=1.0
If Maven is used project specific environment variables can be configured under File->Settings->Build, Execution, Deployment->Build Tools->Maven->Runner
These are reused then in any Maven configuration.
The same mechanism to set the environment variables might also work with different runners.
The problem is, that IntelliJ does not "see" the environment variables that are set in .bashrc (Also to be found in CrazyCoders answer). The easiest way to enable IntelliJ to import those variables is to start it from bash e.g. by typing intellij-idea-community.
I tried various things listed above, and adding the environment variables to the terminal configuration and the Maven build tools worked in some contexts but not others. Then I finally found the place in IntelliJ that actually works for runtime processes. Because why just have one environment variable configuration screen when you can have several and make all but one of them wrong? ^_^
If you edit the template from which your run configurations are created, and add the environment variables to the template, then they should be included in every subsequent run configuration that started with that template.
This is especially useful for the JUnit template, since it will mean that all your custom environment variables will be loaded for unit tests, regardless of the scope from which they're executed (single method, whole test class, whole module). But in general, if you edit the templates first, then any run configuration you create thereafter will inherit your environment variables from the template.
From the top menu: Run → Edit Configurations... → expand Templates tree → (choose a template) → Environment variables: → (enter a semicolon-delimited key-value pair list OR use the input widget)
For the auto-generated JUnit configurations, you should blow away any existing ones, and let IntelliJ recreate new ones as you go; each of these will use the updated JUnit template with your environment variables.
For macOs try adding /Applications/IntelliJ IDEA.app/Contents/bin/idea.properties
...
apple.awt.graphics.UseQuartz=true
apple.awt.fullscreencapturealldisplays=false
idea.jre.check=true
SOME_VAR=some value
As no other answer mentioned it here,
Add your environment variable to /etc/environment , then log out and log in again. IntelliJ will definitely pick it up.
I found another tricky solution :)
At least for Linux users...
Just create some shell script like idea.sh in any suitable location with this content.
#!/bin/bash
export YOUR_ENV_VARIABLE=some value
cd ~/path_to_your_idea_folder/bin
bash ./idea.sh
Make this script executable and run it.
This script will always run your IDE with predefined env variables.
Got to Open 'Edit Run/Debug configurations' dialogs
Go to Modify options
Select Environment variables
New box appears for Environment variables below Active profiles

how to pass user properties file to JMETER through commant prompt

I am using JMETER for load testing. I have large number of user properties in my plan. Its not recommended to pass all these through command prompt because of size issues. I am aware that we can put all the properties in some .properties file and use that file. Like we have the user.properties file in JMETER. But I want to make my own properties file and it should be loaded after the jmeter.properties file. Can anyone guide me how I can do that.
I have gone through a link
http://www.testautomationguru.com/jmeter-property-file-reader-a-custom-config-element/
But not getting how are the following steps to be done
Download this zip file which contains a jar file.
tag-jmeter-extn-1.0.zip (784 downloads)
Go to JMETER_HOME/lib/ext foler.
Place the jar file & Restart JMeter.
Once yo launch the JMeter, You will see ‘Property File Reader’ as given below.
Thankyou
I created the plugin. Did you place the jar file in the /lib/ext folder?
If yes, then close the jmeter and launch again. Under Config Elements - you would see Property File Reader. Give the path of the property file to be read.
You can add as many Property File Reader elements as you want for each property file.
If you do not want to use any external plugin, you can simply pass the property files to the test as shown below.
jmeter -n -t test.jmx -p c/path/to/prop.properties
The main idea of using the plugin is to read the user property file during the design phase/GUI as well. Property File Reader will work in both GUI/non-GUI modes.

jboss-ejb-client.properties in netbeans and .properties

I am using netbeans, and I am writing a wildfly8 EJB client.
I can't find where should I put the jboss-ejb-client.properties file.
I tried to put it in all directories, but the program can't seem to find it.
If I use properties configuration programmatically, the program works, so it just can't find the file.
I could not find any useful information in the debug logs.
Another question:
I need to read a properties file that resides inside the jar of the program, how can i do it?

How to get environment information in Mule

I need to put some production specific behavior in mule-config.xml. Is there a way to get environment info in mule?
You can access all system properties via MEL. But I would rather suggest you modularize your configuration in several files (say: common-config.xml, test-config.xml, prod-config.xml) and load the right files at Mule startup based on the environment.
And also you can create properties file for each environment and access it inside mule config file.
You can create xml file with all the configurations and import/load the file into mule project
In your Mule configuration file (src/main/app/app-config-file.xml), you can add the following line:
<context:property-placeholder location="${environment.name}.properties" />
${environment.name} must be a system environment variable. You need to make sure the system where you are deploying your app contains that variable. I think you can also specify it in the Maven build, if you are using Maven (clean install -Denvironment.name=test). You can try.
To test locally, right click on your project, select run as, select run configurations, click on Environment tab, add your variable "environment.name" and the value "local" (without quotation marks) and make sure your local.properties file exists in a location added to the build path. It can be src/main/app for example or in the resources folder.
MEL has some context objects like server, mule ,application using these you can get the envinformation from #[server.env] for more info refer
https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-basic-syntax
You can use different mule properties file like Mule-dev.properties , mule-test.properties.
In global elements add a property placeholder :
In mule-app.properties define env= test or dev depending on the env value which you want to use.
Clean the project and deploy. Sometimes it is not able to read the env specific properties. Cleaning the project solves this issue.
You can add a properties file in you project and refer it from property place holder. it is better to add environment value in mule-app.properties file ehich is in /src/main/app
you can have one variable like mule.env in this mule-app.properties and send value to this Property as DEV,QA,UAT,PROD from cloudhub properties and create different properties file in mule/src/app main resources then use Properties placeholder to configure this property file and send the value of mule-env dynamically from cloudhub
Typically the way this is done is to delcare a property bean in which you set the environment specific value like PROD,QA,DEV or local. This environment specific value is set in mule-app.properties like mule.env=local, This needs to be set to the environment we are trying to deploy it and the API picks up the right properties file.