I have a few clojure applications that load the sensitive info off of .properties file in /etc/ and this has worked well so far.
Recently, I have had to deal with a few windows machines added into our server collection and I need to run the clojure applications on there as well. Windows doesn't obviously have or understand /etc/ path and I got around that fact by looking at /etc/ and if that's missing then looking at d:\configs.
But I don't quite like this way of doing it, because, if there is another windows developer looking into it and he doesn't have d:\ or prefers elsewhere for configs it would get messy.
Is there any way I can load a file from clojure, no matter what operating system it is? My initial thoughts were of saving a key-path in the Environment variable and accessing it from clojure.
I am just wondering if there is a better way of doing it.
Thanks.
Have a look at environ. It offers some flexibility when it comes to configuring your Clojure app, letting you choose between a number of options:
environment variables: This seems to be the way to go in Clojureland, so I'd say your initial thought wasn't the worst;
in ~/.lein/profiles.clj: You can store them in the :user profile as Clojure data - that sounds quite nice, I guess;
Java CLI properties: Finally, you can pass them to the java executable directly via the command line.
environ will collect data from all these places.
Related
I build my runner and it works fine. However, when it initializes, it first clones the project to /home/user/builds/xxxx... I never, ever, ever want GitLab to use /home. Never. Not for anything. I was told that it is impossible to change it to a different location. I find it hard to believe.
See in the image below, it gives me a warning about templates not found in some made up directory, then clones the entire project under the user's home directory. I don't give it that command - so it must be a default. Is there a way to choose ANY other mount point? The project is several hundred gigabytes and the /home directory is 50k. I cannot control that. So to a different mount point it must go.
I can provide the yml etc, but this is about core behavior of the runner itself - not anything I created. I'm hoping it is a simple variable I can send when initializing the runner.
Thank you in advance.
I'd like to set some specific options in idea.vmoptions and idea.properties for IntelliJ IDEA 14, but I don't have access to those files in C:\Program Files\... (yes, that's Windows, don't troll ;)
Is there a folder in %UserProfile% or an environment variable I could set to read those files (both vmoptions and properties!) from elsewhere?
Please don't suggest to copy the whole IDEA folder elsewhere, there's a reason why I can't access it. I would be interested in a Linux solution too, the same would most likely work on Windows.
My Research
For Mac there're specific instructions at Increasing Memory Heap, but for Linux and Windows it's just filename which are trivial to find out anyway.
I also found IntelliJ IDEA files locations, but it says can be modified in IDEA_HOME\bin\idea.properties which doesn't help since I can't access that file, but want to change properties in it.
Update: Simple Answer
Create IDEA_PROPERTIES and IDEA_VM_OPTIONS environment variables and point them to the files you want, restart IDE, done.
Also see documentation for more (and maybe report that it lacks any mention of IDEA_PROPERTIES).
You can use %USERPROFILE%\.IntelliJIdea14\idea%BITS%.exe.vmoptions on Windows as custom options file. I tried it and it works.
Another way that I haven't tried, but I think should work, is to copy idea.bat and edit it to use the file you need.
I've built a command line tool in Objective-C using Xcode 5.0.2. The target OS being OSX and Linux.
At the moment the command line tool takes an argument which is an API key. The API key will be unique for every user that installs the tool. It is obviously very tedious inputting the API key each time the tool is used, so i need to find a solution to this problem.
What I would like to do is allow the user the ability to save the API key against the tool somehow. Something like:
$ mytool config api.key 123456
I've not done this before, so i would like to know what options I have and what are the best practices for doing so.
My gut feeling was to have the tool write to a config file inside the user's home directory called .mytoolconfig and then have the application load this file if it exists, extract the API key and then know not to prompt for it.
Is this approach reasonably sensible or...?
yes. that's how many UNIX CLI save their configs: they write a . file in the home dir ...
if it were ONLY for osx I'd say .. go for ~/Library/Preferences or so but for *nix it is fine to do it like you proposed.
use HSHomeDirectory() and NSFileManager to achieve that
you could (with some modifications) use NSUserDefaults too but for a CLI I wouldn't
NOTE: personal preference maybe :D
Is there a way in Rails 3 to allow a user to override the Rails configs with a file that does not go into source control?
Even though the 'environments' feature is powerful, providing a 'development' environment out-of-the-box, you still want to give developers a way override even those development defaults for configs that are developer-machine independent.
What I'm hoping for is something like this:
A developer can create a file, config/environments/user.rb that never is checked into git. The developer can do whatever they want in there, and not accidentally affect others using the same source tree.
Background:
We are developing an in house use only cocoa app to help us with some basic sysadmin tasks and complex website deployments. This application is basically a wrapper around many different bash shell commands. The output from these commands will sometimes need to parsed or displayed to the user.
We have played around with NSTask and are able to launch some scripts. However, this seems somewhat cumbersome (needing to set the exact path, passing in each argument separately, etc...). We can use NSTask in this way if this is actually the preferred method.
The biggest challenge so far is setting up the shell environment. We interact with many ruby gems and programs and deploy using capistrano.
The Question is:
How can we interact with the shell with an environment setup like a user? (aliases, rvm, ruby, paths)
The environment variables you'll see set in your shell in Terminal.app are pretty much confined to whatever shell you're using in the Terminal context. It's not picked up by "NSTask" automagically.
But... you do have options. Some of them are described in answers to this related question.
You can set more universal environment variables that do get picked up by NSTask via the "~/.launchd.conf" file, or you can set the shell of "NSTask" to match the one in Terminal (which means you pick up .bashrc or .profile or whatever initializes paths) via "[NSTask setLaunchPath:]" (where the launch path is your shell).
And of course you can also call "system()" from within your tools. This may also pick up the variables set in the "~/.launchd.conf" file.
More information on environment variables is available in this question.