P4EDITOR is set to "vim" in .p4config and I want to use a a different editor inside my Python script. If I change the environment variable P4EDITOR="custom_editor", it has no effect. Seems like perforce looks for .p4config file first and then loooks for environment variables.
OS : freeBSD
If you have a new-enough version of the command-line, use p4 -E P4EDITOR="custom editor" command...; The '-E' flag is described in p4 help undoc, and is specifically intended for overriding variables like P4EDITOR in this way.
Alternately, try setting the environment variable P4CONFIG to something other than ".p4config". Then you won't be using your .p4config settings at all, and your custom setting for P4EDITOR will be in effect. Unfortunately, then you'll have to ensure that you preserve all the other settings from your .p4config file that you wish to retain.
Th best approach would be to upgrade the p4 version and do p4 -E P4EDITOR="custom editor" as suggested by #Bryan.
If upgrading P4 is not an option then copy the the existing .p4config file to a temp file and add P4EDITOR=custom editor to the temporary config file. If the P4EDITOR is already set, then modify it in the temporary config file. Also do export P4CONFIG=temp_config to make the temporary file as the config file.
p4 looks for the config file in the current directory and all it's parents. So the best way to find which config file should be copied and modified is by executing the command p4 set P4CONFIG. This is very useful if there are multiple config files on the machine.
$ p4 set P4CONFIG
P4CONFIG=.p4config (config '/<path>/.p4config')
Use P4CONFIG="" to tell Perforce to not look into P4CONFIG files at all.
Related
My goal is to put my telegraf config into source control. To do so, I have a repo in my user's home directory with the appropriate config file which has already been tested and proven working.
I have added the path to the new config file in the "default" environment variables file:
/etc/default/telegraf
like this:
TELEGRAF_CONFIG_PATH="/home/ubuntu/some_repo/telegraf.conf"
... as well as other required variables such as passwords.
However, when I attempt to run
telegraf --test
It says No config file specified, and could not find one in $TELEGRAF_CONFIG_PATH etc.
Further, if I force it by
telegraf --test --config /home/ubuntu/some_repo/telegraf.conf
Then the process fails because it is missing the other required variables.
Questions:
What am I doing wrong?
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
What am I doing wrong?
See what user:group owns /etc/default/telegraf. This file is better used when running telegraf as a service via systemd. Additionally, if you run env do you see the TELEGRAF_CONFIG_PATH variable? What about your other variables? If not, then you probably need to source the file first.
Is there not also a way of specifying a config directory too (I would like to break my file down into separate input files)?
Yes! Take a look at all the options of telegraf with telegraf --help and you will find:
--config-directory <directory> directory containing additional *.conf files
Perhaps as an alternative to all of this... is there not a way of specifying additional configuration files to be included from within the default /etc/telegraf/telegraf.conf file? (I've been unable to find any mention of this in documentation).
That is not the method I would suggest going down. Check out the config directory option above I mentioned.
Ok, after a LOT of trial and error, I figured everything out. For those facing similar issues, here is your shortcut to the answer:
Firstly, remember that when adding variables to the /etc/default/telegraf file, it must effectively be reloaded. So for example using ubuntu systemctl, that requires a restart.
You can verify that the variables have been loaded successfully using this:
$ sudo strings /proc/<pid>/environ
where <pid> is the "Main PID" from the telegraf status output
Secondly, when testing (eg telegraf --test) then (this is the part that is not necessarily intuitive and isn't documented) you will have to ALSO load the same environmental variables into the current user (eg: SET var=value) such that running
$ env
shows the same results as the previous command.
Hint: This is a good method for loading the current env file directly rather than doing it manually.
I installed Hybris 1905 out of the box locally on my machine and I would like to include the custom code which our project stores on bitbucket.
To track the progress of the commits, I installed earlier Sourcetree and have integrated the repository. The repo is stored locally in directory
C:\git\projectname
How can I now get the folders custom and config into my local installation to be able to run always the latest code in my local machine? Thanks!
You can create a symlink or directory junction.
Assuming your custom config is stored in C:\git\projectname\config and your custom code is stored in C:\git\projectname\bin\custom
In hybrisHomeDirectory, open command prompt then type :
mklink /J config C:\git\projectname\config
this will create a directory junction that link your config to hybris installation folder.
In hybrisHomeDirectory/bin, open command prompt then type :
mklink /J custom C:\git\projectname\bin\custom
This will create a directory junction that link your custom code.
If you want to create a symlink instead of directory junction (requires admin), then open cmd as administrator and type mklink /D instead of mlink /J
Config folder
In order to refer a config folder(other than the default one) you can edit your hybris\bin\platform\setantenv.bat. For example please have a look at my setantenv.bat that I used in the past:
#echo off
set ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Djdk.util.jar.enableMultiRelease=force
set ANT_HOME=%~dp0apache-ant
set PATH=%ANT_HOME%\bin;%PATH%
rem deleting CLASSPATH as a workaround for PLA-8702
set CLASSPATH=
Rem Custom zone start
set HYBRIS_RUNTIME_PROPERTIES=%~dp0local_custom.properties
chcp 65001
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
echo -------CustomChanges--------
echo CustomChanges: configFolder: %HYBRIS_CONFIG_DIR%
echo CustomChanges: runTimeProperties: %HYBRIS_RUNTIME_PROPERTIES%
echo -------CustomChanges--------
Rem Custom zone end
echo ant home: %ANT_HOME%
echo ant opts: %ANT_OPTS%
ant -version
Between Rem Custom zone start and Rem Custom zone end there is the Custom section that, among other things, sets the path to the config folder.
In my case, hybris folder and gitrepo folder are right next to eachother(in the same parent folder) and that is why the following path(also mentioned above) works:
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
Keeping these two folders next to each other makes it easier to use relatives paths in order to easily use resources from git Repo into Hybris.
Custom folder
In order for Hybris to take into consideration the custom extensions, their folder needs to be specified in the localextensions.xml as exemplified below:
<path autoload="true" dir="${HYBRIS_BIN_DIR}/../../gitRepo/extensions"/>
Again, above relative path works for me because hybris and gitrepo folders are next to each other.
I have 2 .properties files for my project on hybris .
First one is used for CI process and as a result a got 4 zip files with my already built platform(after ant production).
On my prod instance i need to switch to another properties because there are all my connections to extended services such as mysql solr.. etc
How i can do that without running all ANT steps.
. ./setantenv.sh && sync && ant config -Denv=my_new_properties
then ./hybrisserver.sh start doesn't work.
There is no information on wiki https://cxwiki.sap.com/display/release5/ant+production+improvements
Check if Updating Configuration Settings at Runtime will be useful for you. You will need to use the FileBasedConfigLoader class and the runtime.config.file.path property.
Other best practices include using system variables for secure settings like DB URL. See "Using Environment Variables instead of Files for Secure Settings" section in Configuring the Behavior of SAP Commerce.
Another option you can look at is to have different config folders for different environments (e.g. config-dev, config-prd), and pass it to ant. e..g -Denv=config--dev
I am trying to set my environment variables to
$env:DEBUG="*,-babel"
But I cant figure out where to use this setting in the Atom editor
To make the shell's environment variables available to Atom, install following two small atom packages:
env-from-shell
auto-run
env-from-shell settings: enter comma delimited list of needed environment variables in it's settings panel. Check off auto-run box.
auto-run settings: if not already present, enter env-from-shell:copy in it's settings panel. A benefit of the env-from-shell package is no external configuration files have to be moved from directory to directory as projects change.
Try setting
process.env.DEBUG = "*,-babel"
in your (new) $HOME/.atom/init.coffee init file.
(Your directory may vary, see your process.env.ATOM_HOME.)
Currently, the .NST files after build are getting generated at "C:\Users\XYZ\AppData\Local\Fortify\sca6.2\build" folder. How can I change the it to some other folder in my system?
There are two files that need to be updated, located in the /Core/config:
fortify.properties
com.fortify.WorkingDirectory=${win32.LocalAppdata}/Fortify
fortify-sca.properties
com.fortify.sca.ProjectRoot=${win32.LocalAppdata}/Fortify
If you are also using the Eclipse plugin, make sure to change the files inside of there as well:
\plugins\com.fortify.dev.ide.eclipse_X.XX.X\Core\config\fortify.properties"
Make sure that fortify will have permissions to read/write to the new target location. Depending on how locked down your environment is (permissions, GPs) this could be tricky.
Update:
If you wanted to change a setting for once scan and/or cannot update the properties files, you can update the properties through commandline arguments.
You would need to pass these arguments on all commands to sourceanalyzer to work (clean, translate, and scan).
For any propertie that needs to change, you pass the following in the command:
-D<property>=<value>
In this case (assuming you want to put the working directory D:\Samples\eightball\working Directory):
-Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory"
Here is the batch file I used to scan the EightBall.java example file (normally located at <fortify Install Dir>\Samples\Basic\EightBall\ and moved it to D:\Samples\EightBall\
# Clean
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -clean
# Translate
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -source 1.5 EightBall.java
# Scan
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -scan -f EightBall.fpr