feat(taskserv): implement real-time version checking with configurable HTTP client
- Add: GitHub API integration for live version checking in taskserv management - Add: HTTP client configuration option (http.use_curl) in config.defaults.toml - Add: Helper function fetch_latest_version with curl/http get support - Fix: Settings path structure for prov_data_dirpath access pattern - Remove: Legacy simulation code for version checking - Update: Core configuration name from "provisioning-system" to "provisioning" - Clean: Remove obsolete example configs and infrastructure files
This commit is contained in:
parent
38a7470da0
commit
3c3ef47f7f
34 changed files with 5942 additions and 13 deletions
|
|
@ -308,9 +308,11 @@ export def load [
|
|||
if (is-debug-enabled) { _print $"DEBUG work path: ($wk_settings_path)" }
|
||||
let servers_paths = ($settings_data | get -o servers_paths | default [])
|
||||
# Set full path for provider data
|
||||
let data_fullpath = if ($settings_data.prov_data_dirpath | str starts-with "." ) {
|
||||
($src_dir | path join $settings_data.prov_data_dirpath)
|
||||
} else { $settings_data.prov_data_dirpath }
|
||||
let data_fullpath = if (($settings_data | get -o data.prov_data_dirpath) != null and ($settings_data.data.prov_data_dirpath | str starts-with "." )) {
|
||||
($src_dir | path join $settings_data.data.prov_data_dirpath)
|
||||
} else {
|
||||
($settings_data | get -o data.prov_data_dirpath | default "providers")
|
||||
}
|
||||
mut list_servers = []
|
||||
mut providers_settings = []
|
||||
for it in $servers_paths {
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export def detect-version [
|
|||
let url = ($config | get -o url | default "")
|
||||
if ($url | is-empty) { return "" }
|
||||
|
||||
let result = (http get $url --headers [User-Agent "nushell-version-checker"] | complete)
|
||||
let result = (http get $url --headers [User-Agent "provisionin-version-checker"] | complete)
|
||||
if $result.exit_code == 0 and ($result.stdout | length) > 0 {
|
||||
let response = ($result.stdout | from json)
|
||||
if ($config | get -o field | is-not-empty) {
|
||||
|
|
@ -166,7 +166,7 @@ export def fetch-versions [
|
|||
]
|
||||
|
||||
for endpoint in $endpoints {
|
||||
let response = (http get $endpoint --headers [User-Agent "nushell-version-checker"] | default [] | to json | from json | default [])
|
||||
let response = (http get $endpoint --headers [User-Agent "provisionin-version-checker"] | default [] | to json | from json | default [])
|
||||
if ($response | length) > 0 {
|
||||
return ($response
|
||||
| first $limit
|
||||
|
|
@ -188,7 +188,7 @@ export def fetch-versions [
|
|||
let repo = ($parts | last)
|
||||
|
||||
let url = $"https://hub.docker.com/v2/namespaces/($namespace)/repositories/($repo)/tags"
|
||||
let result = (http get $url --headers [User-Agent "nushell-version-checker"] | complete)
|
||||
let result = (http get $url --headers [User-Agent "provisionin-version-checker"] | complete)
|
||||
if $result.exit_code == 0 and ($result.stdout | length) > 0 {
|
||||
let response = ($result.stdout | from json)
|
||||
if ($response | get -o results | is-not-empty) {
|
||||
|
|
@ -208,7 +208,7 @@ export def fetch-versions [
|
|||
let url = ($config | get -o url | default "")
|
||||
if ($url | is-empty) { return [] }
|
||||
|
||||
let result = (http get $url --headers [User-Agent "nushell-version-checker"] | complete)
|
||||
let result = (http get $url --headers [User-Agent "provisionin-version-checker"] | complete)
|
||||
if $result.exit_code == 0 and ($result.stdout | length) > 0 {
|
||||
let response = ($result.stdout | from json)
|
||||
let field = ($config | get -o field | default "")
|
||||
|
|
@ -282,4 +282,4 @@ export def check-version [
|
|||
fixed: $is_fixed
|
||||
status: $status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue