How do you set boolean values with "yarn config"? - yarnpkg

The following should illustrate the problem:
using yarn config set strict-ssl false will not have the desired result. Does anybody know how to set this to boolean false instead of string 'false'?

$ yarn config set strict-ssl true --global
success Set "strict-ssl" to true.
$ yarn config set strict-ssl false --global
success Set "strict-ssl" to "false".

For Yarn 2 or later, add this to yarnrc.yml file
enableStrictSsl: false

Related

Heroku NODE_ENV is always "development" despite setting config var to "staging" (NestJS app)

In my Heroku environment where I deploy my NestJS application, I set all my Config Vars through the Heroku UI. I have set my NODE_ENV config var to staging using the Heroku UI. I've even ran this command heroku config:set NODE_ENV=staging -a <my-staging-environment. When I run heroku config -a <my-staging-environment>, I see that NODE_ENV is set to staging, but for whatever reason, when I console.log this variable from my code, it outputs development. Below is some example code where it is logs development as the value for NODE_ENV in my TypeOrm configuration. This is causing the ssl property to not get set to the correct value, and I cannot connect to my Heroku Postgres database because of it. I only intend to set it to development for local development purposes.
require('dotenv').config();
console.log(process.env.NODE_ENV); // outputs "development" - idk where this value is coming from
console.log(process.env.DATABASE_URL); // outputs the correct value that I set in Heroku Config Vars
const typeOrmConfig: TypeOrmModuleOptions = {
type: 'postgres',
url: process.env.DATABASE_URL,
ssl: process.env.NODE_ENV !== 'development' ? { rejectUnauthorized: false } : false, // ternary evaluates to the wrong value
// ... other config options
};
I use dotenv, and I made sure to .gitignore my .env file. I don't recall ever setting this variable to development. The only place I see it set to NODE_ENV=development in my code is in my .env-example file. I do commit this file to source control, but it's just an example file and not a real .env file and it shouldn't actually be being used.
Does anyone have any idea why this is happening?
I have found that it is not a Heroku issue. Rather it is a NestJS/Nx issue.
See:
process.env.NODE_ENV always 'development' when building nestjs app with nrwl nx

Why is my Anaconda prompt modifier showing the full environment path?

I modified my anaconda environment directories. Any environments installed in the alternative directories show their full path in the prompt modifier. I am expecting only the name of the environment. Why is the full path showing up? Is this only aesthetic or will other things be affected?
Typically when creating an environment using anaconda prompt and the command:
>conda create -n my_env
I activate the environment using:
conda activate my_env
and the prompt changes from (base) to:
(my_env)>
I wish to share environments between users on the same machine. Following https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-env-directories I added a file .condarc to the base conda install path containing:
#
envs_dirs:
- C:\Users\Public\CondaEnvs
Creating a new environment in the same way when I activate this environment I now see:
(C:\Users\Public\CondaEnvs\my_shared_env)
When the environment is active the environment variable CONDA_PROMPT_MODIFIER has also been set to (C:\Users\Public\CondaEnvs\my_shared_env).
The current output of conda config --show is:
add_anaconda_token: True
add_pip_as_python_dependency: True
aggressive_update_packages:
- ca-certificates
- certifi
- openssl
allow_conda_downgrades: False
allow_cycles: True
allow_non_channel_urls: False
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: None
anaconda_upload: None
auto_activate_base: True
auto_update_conda: True
bld_path:
changeps1: True
channel_alias: https://conda.anaconda.org
channel_priority: flexible
channels:
- defaults
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
conda_build: {}
create_default_packages: []
croot: C:\Users\ClibbonA\conda-bld
custom_channels:
pkgs/main: https://repo.anaconda.com
pkgs/free: https://repo.anaconda.com
pkgs/r: https://repo.anaconda.com
pkgs/msys2: https://repo.anaconda.com
pkgs/pro: https://repo.anaconda.com
custom_multichannels:
defaults:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/free
- https://repo.anaconda.com/pkgs/r
- https://repo.anaconda.com/pkgs/msys2
local:
debug: False
default_channels:
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/free
- https://repo.anaconda.com/pkgs/r
- https://repo.anaconda.com/pkgs/msys2
default_python: 3.7
deps_modifier: not_set
dev: False
disallowed_packages: []
download_only: False
dry_run: False
enable_private_envs: False
env_prompt: ({default_env})
envs_dirs:
- C:\Users\Public\CondaEnvs
- C:\Users\ClibbonA\.conda\envs
- C:\ProgramData\Anaconda3\envs
- C:\Users\ClibbonA\AppData\Local\conda\conda\envs
error_upload_url: https://conda.io/conda-post/unexpected-error
extra_safety_checks: False
force: False
force_32bit: False
force_reinstall: False
force_remove: False
ignore_pinned: False
json: False
local_repodata_ttl: 1
migrated_channel_aliases: []
migrated_custom_channels: {}
non_admin_enabled: True
notify_outdated_conda: True
offline: False
override_channels_enabled: True
path_conflict: clobber
pinned_packages: []
pip_interop_enabled: False
pkgs_dirs:
- C:\ProgramData\Anaconda3\pkgs
- C:\Users\ClibbonA\.conda\pkgs
- C:\Users\ClibbonA\AppData\Local\conda\conda\pkgs
proxy_servers: {}
prune: False
quiet: False
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
report_errors: None
rollback_enabled: True
root_prefix: C:\ProgramData\Anaconda3
safety_checks: warn
sat_solver: pycosat
shortcuts: True
show_channel_urls: None
solver_ignore_timestamps: False
ssl_verify: True
subdir: win-64
subdirs:
- win-64
- noarch
target_prefix_override:
track_features: []
update_modifier: update_specs
use_index_cache: False
use_local: False
verbosity: 0
whitelist_channels: []
According to the conda documentation, you need to use the command conda config --set env_prompt "({name}) " (use double quotes on windows). Following these instructions, I found that when I deactivate the environment, the prepended string doesn't read (base) , but (Anaconda3) . That's a bit inconsistent with what people report, but maybe it's a windows thing. Just like the double quotes :p
Elsewhere on Stackoverflow someone has looked into the whole thing a bit and shown a few commands which sort of allow to circumvent this problem, although it's not very convenient to keep having to enter them. Based on the answers in that thread, I pieced together the following solution which did the trick for me:
Let's assume you created a virtual environment called myenv. Place a .condarc file in its directory (i. e., <current directory>\myenv\.condarc). The content of the file should be env_prompt: "({default_env}) " (plus other entries relevant to your project).
If you don't already have a general .condarc file, create one using the command conda config --set env_prompt "({name}) " with a whitespace after the closing parenthesis if you so desire. If such a file exists already, it should contain the line env_prompt: "({name}) ".
Now start your conda console. The environment prompt initially shows (Anaconda3) , but as soon as you activate and deactivate your virtual environment, everything's displayded the way it's supposed to. The command conda env list always displays the asterisk next to the correct environment when myenv is activated.
Have you tried:
conda activate env_name
Or
source activate env_name
? This commands should activate your environment(s) and you shouldn't have whole url path in your running program.
env_name
is the name of your environment.
You may try too this one:
conda config --set changeps1 False
You have to restart the command prompt after that, i.e. run your program in another window.

enable scripting in elasticsearch 2.2.1

Elasticsearch-2.2.1 wont start when I add the line
script.disable_dynamic: false
to my elasticsearch.yml file as show Here
What is could be causing this?
check instruction for appropriate version. Link you provided for version 1.6
script.inline: true
script.indexed: true

capistrano deploy_via :copy using git tags?

I'm new to capistrano and I'm trying to figure out if it's possible to deploy to multiple servers by using a push method with git tags as a reference. It's a little more complicated than that, as these are Windows servers with FreeSSH installed. I have this so far:
deploy.rb:
set :application, "iis_app"
set :repo_url, "iis_repo"
set :deploy_via, :copy
set :copy_cache, true
server definitions:
role :push_servers, %w{"srv1" "srv2" "srv3" "srv4"}
ssh_options: {
user: "windows_user",
forward_agent: true,
auth_methods: %w(password),
password: ENV["WINDOWS_PW"]
}
Otherwise I'm a bit lost. If someone could point me in the right direction, that would be great.
Your config looks fine. The only thing is that your :repo_url should be something like this:
git#github.com:mycompany/myrepo.git
A git tag is essentially translates to a revision (SHA1 hash) so you can just do something like this:
For Capistrano 2.9 and above:
cap -S revision=<the sha1 of your tag> deploy
For older versions of Capistrano, you can do this:
cap -s branch=<the sha1 of your tag> deploy
Hope it helps.

Capistrano: No such file or directory

I'm really new to Capistrano and am having a tough time getting it setup. I'm using a Windows local machine, Linux server and BitBucket for my git repo. When I run cap deploy I get the following error:
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railsless-deploy-1.1.2/lib/railsless-deploy.rb:98:in ``': No such file or directory - git ls-remote git#bitbucket.org:je3415/captest.git HEAD
(Errno::ENOENT)
When I SSH into the server I'm able to run git ls-remote git#bitbucket.org:je3415/captest.git HEAD without any problem. I also tried creating a public key with and without a passphrase. That made no difference as well.
Any suggestions would be really appreciated. Thanks.
Edit:
Here is the contents of my capfile:
require 'railsless-deploy'
load 'config/deploy'
And the beginning of my deploy.rb file looks like this:
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :application, "captest" # TODO
set :repository, "git#bitbucket.org:je3415/captest.git" # TODO
set :scm, :git
set :use_sudo, false
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :deploy_via, :remote_cache
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules"]
set :git_enable_submodules, 1
set :wp_multisite, 0 # TODO Set to 1 if multisite
I was able to solve this by adding the location of my Git binaries to the Windows PATH environment variable. Thanks to #maksim for posting the solution at https://stackoverflow.com/a/8978686/868082.

Resources