Skip to content

Change the directory of the configuration files #140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Feb 15, 2019
Merged

Change the directory of the configuration files #140

merged 26 commits into from
Feb 15, 2019

Conversation

matteosuppo
Copy link
Contributor

If you install the arduino cli, the default directory
of the configuration file is the location of the executable
This is not an ideal configuration for linux or windows

With this commit the configuration file is searched in the
default configuration folder for each system

@matteosuppo matteosuppo requested a review from cmaglie January 31, 2019 16:15
@CLAassistant
Copy link

CLAassistant commented Jan 31, 2019

CLA assistant check
All committers have signed the CLA.

If you install the arduino cli, the default directory
of the configuration file is the location of the executable
This is not an ideal configuration for linux or windows

With this commit the configuration file is searched in the
default configuration folder for each system
@cmaglie
Copy link
Member

cmaglie commented Jan 31, 2019

I see that, on linux, the library searches in ~/.config/.... and /etc/xdg/....

~/.config/arduino15 may have been a valid alterantive if used from the beginning but since we used ~/.arduino15 to store everything I'd like to continue to use that one. Also /etc/xdg seems a bit overkill to me, why the extra xdg sub-folder? /etc/arduino-cli.conf seems enough...

@cmaglie
Copy link
Member

cmaglie commented Jan 31, 2019

Let's implement here some ideas from: #30
To recap some points:

  1. We should look for a configuration in some predefined places, for example on Linux:
  • /etc/
  • ~/.arduino15/
  • ${pwd}

those directories are listed in increasing order of priority and any config file found should override the previous one (I mean the options defined in ${pwd} should take priority on the ones in /etc for example).

  1. we can navigate parent folders for ${pwd} to search for a config file, this would allow to make a per-project configuration.

and this is added by me:

  1. we should consider a better future-proof name for the config file like: arduino-cli.conf so we have a nice /etc/arduino-cli.conf instead of /etc/.cli-config.yaml

@bxparks
Copy link

bxparks commented Jan 31, 2019

Do we need to worry about $arduino_ide_dir/portable, as described in https://www.arduino.cc/en/Guide/PortableIDE ? I don't use ~/.arduino15, because I keep multiple versions of the IDE around for testing, and I don't want one version of the IDE clobbering the files and configs of another version.

This function will navigate the filesystem scraping the fs
searching for config files. It will search in $pwd navigating
through parent folders stopping at $root
@cmaglie
Copy link
Member

cmaglie commented Feb 1, 2019

@bxparks we pushed forward portable support here: #123

Also we started bundling the cli in the official Beta IDE, at the moment arduino-cli detects if it's bundled with the IDE and also if there is a portable folder:

~/Code/arduino/build/linux/work$ ls -l
total 29272
-rwxr-xr-x  1 cmaglie cmaglie      882 feb  1 10:05 arduino
-rwxr-xr-x  1 cmaglie cmaglie 13822120 feb  1 10:05 arduino-builder
-rwxr-xr-x  1 cmaglie cmaglie 16000485 feb  1 10:05 arduino-cli
-rwxr-xr-x  1 cmaglie cmaglie     5161 feb  1 10:05 arduino-linux-setup.sh
drwxr-xr-x 13 cmaglie cmaglie     4096 feb  1 10:05 examples
drwxr-xr-x  4 cmaglie cmaglie     4096 feb  1 10:05 hardware
-rwxr-xr-x  1 cmaglie cmaglie     9796 feb  1 10:05 install.sh
drwxr-xr-x  4 cmaglie cmaglie     4096 feb  1 10:05 lib
drwxr-xr-x 21 cmaglie cmaglie     4096 feb  1 10:05 libraries
drwxr-xr-x  6 cmaglie cmaglie     4096 feb  1 10:05 reference
-rw-r--r--  1 cmaglie cmaglie    87826 feb  1 10:05 revisions.txt
drwxr-xr-x  4 cmaglie cmaglie     4096 feb  1 10:05 tools
drwxr-xr-x  4 cmaglie cmaglie     4096 gen  3 17:15 tools-builder
-rwxr-xr-x  1 cmaglie cmaglie       86 feb  1 10:05 uninstall.sh
~/Code/arduino/build/linux/work$ ./arduino-cli config dump
proxy_type: auto
sketchbook_path: /home/cmaglie/Workspace/sketchbook-cores-beta
arduino_data: /home/cmaglie/.arduino15
board_manager:
  additional_urls:
  - http://arduino.esp8266.com/stable/package_esp8266com_index.json

~/Code/arduino/build/linux/work$ mkdir portable
~/Code/arduino/build/linux/work$ ./arduino-cli config dump
proxy_type: auto
sketchbook_path: /home/cmaglie/Code/arduino/build/linux/work/portable/sketchbook
arduino_data: /home/cmaglie/Code/arduino/build/linux/work/portable
board_manager: null

BTW we barely tested the "portable" scenario, (for example now I noticed the board_mager: null in the config dump) so it may require some more work.

@matteosuppo
Copy link
Contributor Author

In this latest batch of commits I implemented the following:

we can navigate parent folders for ${pwd} to search for a config file, this would allow to make a per-project configuration.

@matteosuppo matteosuppo merged commit f526b36 into master Feb 15, 2019
@cmaglie cmaglie deleted the config branch February 19, 2019 15:17
@cmaglie cmaglie added this to the 0.3.5-alpha.preview milestone Feb 20, 2019
mastrolinux pushed a commit that referenced this pull request Jul 16, 2019
Change the directory of the configuration files
per1234 pushed a commit that referenced this pull request Nov 16, 2020
…te-policy

Default value for update policy and rate limit
per1234 added a commit that referenced this pull request Aug 9, 2021
Quote password in signing certificate import command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants