Skip to content

Commit

Permalink
docs: describe new configuration variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Bianconi committed Jan 16, 2023
1 parent 0710afa commit f5a4c7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func maybePurgeBuildCache() {
}
inventory.Store.Set("build_cache.compilation_count_since_last_purge", 0)

cacheTTL := configuration.Settings.GetDuration("build_cache.ttl")
cacheTTL := configuration.Settings.GetDuration("build_cache.ttl").Abs()
buildcache.Purge(paths.TempDir().Join("arduino", "cores"), cacheTTL)
buildcache.Purge(paths.TempDir().Join("arduino", "sketches"), cacheTTL)
}
3 changes: 3 additions & 0 deletions configuration/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package configuration

import (
"fmt"
"path/filepath"
"strings"
"time"
Expand Down Expand Up @@ -69,4 +70,6 @@ func SetDefaults(settings *viper.Viper) {
settings.BindEnv("directories.Downloads", "ARDUINO_DOWNLOADS_DIR")
settings.BindEnv("directories.Data", "ARDUINO_DATA_DIR")
settings.BindEnv("sketch.always_export_binaries", "ARDUINO_SKETCH_ALWAYS_EXPORT_BINARIES")
fmt.Println(settings.GetDuration("build_cache.ttl"))
panic(false)
}
6 changes: 6 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
to the sketch folder. This is the equivalent of using the [`--export-binaries`][arduino-cli compile options] flag.
- `updater` - configuration options related to Arduino CLI updates
- `enable_notification` - set to `false` to disable notifications of new Arduino CLI releases, defaults to `true`
- `build_cache` configuration options related to the compilation cache
- `compilations_before_purge` - interval, in number of compilations, at which the cache is purged, defaults to `10`.
When `0` the cache is never purged.
- `ttl` - cache expiration time of build folders. If the cache is hit by a compilation the corresponding build files
lifetime is renewed. The value format must be a valid input for
[time.ParseDuration()](https://pkg.go.dev/time#ParseDuration), defaults to `720h` (30 days).

## Configuration methods

Expand Down

0 comments on commit f5a4c7d

Please sign in to comment.