# Openbalena CLI optimization

**URL:** <https://forums.balena.io/t/openbalena-cli-optimization/268322>\
**Category:** openBalena\
**Created:** [March 9, 2021, 9:23pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322 "2021-03-09T21:23:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [March 9, 2021, 9:23pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/1 "2021-03-09T21:23:41Z")

</div>

Hi there, curious if there are some tricks to make working with openbalena and the CLI a little easier.

For example, every time I open a new terminal to log in I have to run the `export NODE_EXTRA_CA_CERTS='/path/to/ca.crt'` command which makes me wonder if there is a way to automate that without screwing up my balenacloud experience from the same machine.

Also, because I can only log into the openbalena instance from within a folder I called openbalena, I find myself moving projects into that folder to build and deploy to openbalena and then move them back out to my actual projects folder when done, which is a little messy. Am I overlooking a trick here too?

What would be really sweet would be to have a global CLI experience that lets you pick and choose which servers to interact with via a command or cli menu. For example from any where you can do `balena login openbalena` without having to do that from a specific folder.

Maybe I’m not doing it right though…

---

<div class="post-metadata">

**Author:** ![klutchell](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/klutchell/32/861_2.png) [@klutchell](https://forums.balena.io/u/klutchell)\
**Post date:** [March 9, 2021, 9:48pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/3 "2021-03-09T21:48:33Z")

</div>

Hey there, I see some of these pain points and I can make a suggestion. If you’re running Linux you can accomplish this with some aliases in your `~/.profile` or `~/.bashrc`.

Here’s an example from mine:

```bash
devenv-login() {
    export BALENARC_BALENA_URL='my.devenv.local'
    export NODE_EXTRA_CA_CERTS='/path/to/ca.crt'
    balena login
}

```

I don’t believe you should have to work within the openbalena folder just to push new apps, as long as your `BALENARC_BALENA_URL` and `NODE_EXTRA_CA_CERTS` are set for the correct server you should be able to perform actions from anywhere. If this aspect isn’t working for you we can try to figure out why!

---

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [March 9, 2021, 11:27pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/5 "2021-03-09T23:27:11Z")

</div>

Thanks for the tips! Unfort I’m not on a linux machine though.

---

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [March 9, 2021, 11:45pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/6 "2021-03-09T23:45:04Z")

</div>

@klutchell wild question, but if someone decided the were only going to use openbalena the cli could be customized and built from source theoretically?

---

<div class="post-metadata">

**Author:** ![rahul-thakoor](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@rahul-thakoor](https://forums.balena.io/u/rahul-thakoor)\
**Post date:** [March 10, 2021, 1:16pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/8 "2021-03-10T13:16:45Z")

</div>

hey there,

What operating system are you running this on?

As for working from a specific folder, have you set up a `balenarc.yml` file in the folder so that the cli picks up those configurations? This is documented [here](https://www.balena.io/docs/learn/more/masterclasses/advanced-cli/#13-separate-environment-configurations)

as for your ques:

> if someone decided the were only going to use openbalena the cli could be customized and built from source theoretically

in theory, yes, but that’s not technically recommended. Perhaps we can work together to make the exoerience with the CLI better and it can benefit other users too.

Please help me better understand the constraints and pain points.

thanks

---

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [March 14, 2021, 8:14pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/10 "2021-03-14T20:14:08Z")

</div>

Thanks for clarifying @rahul-thakoor. I fear I’d be in way over my head if I tried to assist in making changes to the CLI.  
I can provide a list of some suggestions though… Let me put together a few ideas and post here.

---

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [March 14, 2021, 8:26pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/11 "2021-03-14T20:26:42Z")

</div>

Here’s one problem I noticed…

In the ui of balena cloud it is possible to create a variable like this:

`DD_TAGS: name:joe env:test another:true`

Where the value can contain multiple “:” colons.

Whereas this seems to fail when trying to do the same with the CLI.

---

<div class="post-metadata">

**Author:** ![anujdeshpande](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/anujdeshpande/32/3155_2.png) [@anujdeshpande](https://forums.balena.io/u/anujdeshpande)\
**Post date:** [March 24, 2021, 7:07am UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/12 "2021-03-24T07:07:01Z")

</div>

Hi

`balena env add TAGS2 'name:joe env:test2' --application appName` I was able to run this command successfully. Perhaps you missed the comma?

---

<div class="post-metadata">

**Author:** ![anujdeshpande](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/anujdeshpande/32/3155_2.png) [@anujdeshpande](https://forums.balena.io/u/anujdeshpande)\
**Post date:** [March 24, 2021, 7:07am UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/13 "2021-03-24T07:07:03Z")

</div>

A file has been uploaded using Jellyfish: [Jellyfish](https://jel.ly.fish/823e9a07-95d1-4915-bdae-23ea7a9dea64)

---

<div class="post-metadata">

**Author:** ![barryjump](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@barryjump](https://forums.balena.io/u/barryjump)\
**Post date:** [April 6, 2021, 1:12pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/17 "2021-04-06T13:12:04Z")

</div>

> [@anujdeshpande](#):
>
> `balena env add TAGS2 'name:joe env:test2' --application appName` I was able to run this command successfully. Perhaps you missed the comma?

Thanks @anujdeshpande you’re absolutely right, I was forgetting the apostrophes!  
Thanks a bunch!

---

<div class="post-metadata">

**Author:** ![tmigone](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/tmigone/32/2814_2.png) [@tmigone](https://forums.balena.io/u/tmigone)\
**Post date:** [April 6, 2021, 3:11pm UTC](https://forums.balena.io/t/openbalena-cli-optimization/268322/18 "2021-04-06T15:11:17Z")

</div>

Glad to know Anuj’s suggestion worked. Cheers!
