I want to activate NEAR mainnet instead of the default TESTNET in the NEAR-CLI - protocols

I'm trying to activate the NEAR mainnet on the NEAR-CLI but when typing NEAR-ENV=mainnet it says unknown argument.

If you are trying to set the default to mainnet you need to run:
export NEAR_ENV=mainnet
Alternatively, you can change the network by prepending an environment variable to your command.
Example:
NEAR_ENV=mainnet near send ...
See the CLI Docs for more info:
https://docs.near.org/tools/near-cli#network-selection

Try out the new https://near.cli.rs. It should be more intuitive.

Related

Postman api key not valid in gitlab-ci

In my gitbal-ci.yml using the below instruction:
curl -s https://api.getpostman.com/environments?apikey=${POSTMAN_APIKEY}
I receive the error:
error: could not load environment
Invalid API Key. Every request requires a valid API Key to be sent.
The variable POSTMAN_APIKEY is correctly set in my gitlab Setting CI/CD as POSTMAN_API with the key generated in my postman account.
If I try to execute the curl command via shell, it works perfectly.
What's wrong? thanks
I think you should use double quotes "curl -s https://api.getpostman.com/environments?apikey=${POSTMAN_APIKEY}" because of variable expansion in bash. But variable name must be the same in Setting CI/CD, so POSTMAN_APIKEY in both places. If you set variable as protected, be sure to flag your branch as protected as well.

How to achieve to and fro questions like command using commander.js?

I want to achieve something like folloing using commander.js
$ my-tool create-environment
Press ^C at any time to quit.
environment name: (UAT) : Prod
environment url : hhtps:www.google.com
Created new environment Prod
$
Please note here user has to hit ENTER after provide environment name and url. Its kind of to and from asking for inout rather than giving all options in single command.
I had been struggling with the commander.js documentation but no luck so far. I would be thankful if someone could help me achieve this.
Commander documentation
Thanks in advance,
Deepak
Commander is used for parsing arguments, but does not interactively prompt for missing command-arguments or options.
You could use Commander to process the command-line arguments, then use something like Inquirer to prompt for values which are missing. Using that combination might look like:
$ my-tool create-environment --url https://www.google.com
Press ^C at any time to quit.
environment name: (UAT) : Prod
Created new environment Prod
$ my-tool create-environment --name Prod
Press ^C at any time to quit.
environment url : https://www.google.com
Created new environment Prod

NodeJS Google Vision is unable to detect a Project Id in the current environment

Under Ubuntu environment, NodeJS Google Vision complains:
Error: Unable to detect a Project Id in the current environment.
Even though I already put json credential through
$ export GOOGLE_APPLICATION_CREDENTIALS=/var/credential_google.json"
Please help.
As a quick hack you can try this :
$ GOOGLE_APPLICATION_CREDENTIALS="/var/credential_google.json" node app.js
It's not recommended to use a .json config file locally. I've seen these leak on production servers causing whole platforms to be deleted + the introduce environmental switching and security issues.
Setup Google Cloud CLI.
Now the server will 'look' at the local environment and use that.
If you get the error "Unable to detect a Project Id in the current environment.", it means the auth library cannot find the project default id.
You need to have a base project in Google Cloud set, regardless of environmental variables and project you're running.
Run
gcloud config set project [some-project-id]
Now if you run (node example)
"dev": "NODE_ENV=dev GCP_PROJECT=some-project-id nodemon index.ts",
It will load the project environment. This also allows you to deploy easier with:
"deploy:dev": "y | gcloud app deploy --project some-dev-project app.yaml",
"deploy:prod": "y | gcloud app deploy --project some-prod-project app.yaml"
App engine has security setup automatically with standard environments. With flex you can use one of the manage images Google Provides.
If you are usually a windows user and trying out Ubuntu (like me), the problem is likely with the assumptions that the export command exports variable to all terminal sessions and that you need to open a new terminal to get it to use (as expected in a windows terminal for an environment variable).
The export command doesn't export the variable to another terminal session. So if you export it in a terminal, you use it on the same terminal.
If you would like to export it permanently, then you can try the solution listed here
You can put the path to the JSON credentials directly when instantiating the client, by passing it as an argument.
For example:
const client = new speech.SpeechClient( {keyFilename: "credential_google.json"});
Also, for me setting it in the terminal didn't work.

how to setup npm environment variables in windows

i have a Windows machine. i need to setup the npm private profile to accept private packages for my code. my dev team has provided only a hexadecimal token for the setup.
The npm documentation describes to use the token like this
export NPM_TOKEN="00000000-0000-0000-0000-000000000000". but windows machine is not accepting this command.
can anyone help me on setting the npm token in a windows 10 laptop.
You can do this:
In Windows search bar: Start typing something like variables or environment var and click on the Edit environment variables for your account entry
In the opened window click on New... button in User variables section.
Variable name: NPM_TOKEN
Variable value: 00000000-0000-0000-0000-000000000000 (use your own token)
Save and restart computer
It should be done
Another method
In PowerShell, you can set environment variable by $env:path=value.
This will be applicable only to that Powershell session only.

Unable to remove module of node-red

I am having issues with node-red and can no longer run any flows, i am not sure what to do anymore.
i get the following error
Imported unrecognised type: mqtt-env-broker
Flows stopped due to missing node types. Check logs for details.
Tried to remove this module from the palette but get the following error, i am also unable to disable it
Failed to remove: node-red-contrib-mqtt-env
Error: Type in use: mqtt-env-broker
Check the log for more information
I have installed the node-red-admin and tried to remove it from command line, so i issued the following command
sudo node-red-admin remove node-red-contrib-mqtt-env/mqtt-env
i get the following error
404: Cannot DELETE /nodes/node-red-contrib-mqtt-env/mqtt-env
this is what i get when i ran the following command
node-red-admin list
Nodes Types State
node-red-contrib-mqtt-env/mqtt-env mqtt-env in error
mqtt-env out
mqtt-env-broker
node-red-dashboard/ui_audio ui_audio enabled
...
...
node-red/mqtt mqtt in error
mqtt out
mqtt-broker
The flows are stopped because they are trying to use a node type you have not got installed - or in this instance, it appears, is hitting an error when it tries to start
The runtime won't let you remove the node because it is referenced in your flow.
To fix this you need to delete any of the nodes referenced by this module from your flow. The name mqtt-env-broker suggests it is a configuration node rather than a regular flow node. Open the Configuration Nodes sidebar panel (from the drop-down menu) and look for any unknown config nodes. Double click on them and delete them. Once you've removed them, hit deploy and things should start working again.
You should then be able to delete the node module from your runtime.

Resources