← 返回
未分类 Key 中文

Configure Telerik NuGet

Helps setup, configure and manage Telerik NuGet feeds in your repo's nuget.config file.
帮助在仓库的 nuget.config 文件中设置、配置和管理 Telerik NuGet 源。
lancemccarthy lancemccarthy 来源
未分类 clawhub v1.1.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 341
下载
💾 0
安装
1
版本
#latest

概述

Use these helper functions to manage Telerik NuGet source configuration.

Get a new api key at https://www.telerik.com/account/downloads/api-keys

Function: configure

Sets a global user environment variable for the Telerik API key and updates/creates nuget.config so credentials use the environment variable instead of a hardcoded secret.

function Configure-TelerikNuGetSource {
	param(
		[Parameter(Mandatory = $true)]
		[string]$ApiKey,

		[string]$ApiKeyEnvVarName = "TELERIK_NUGET_API_KEY",
		[string]$SourceName = "Telerik_NuGet_Server",
		[string]$SourceUrl = "https://nuget.telerik.com/v3/index.json",
		[string]$NuGetConfigPath = "./nuget.config"
	)

	# Store API key as a user-level environment variable so it is available globally
	[Environment]::SetEnvironmentVariable($ApiKeyEnvVarName, $ApiKey, "User")
	$env:$ApiKeyEnvVarName = $ApiKey

	if (-not (Test-Path $NuGetConfigPath)) {
		@"
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources />
  <packageSourceCredentials />
</configuration>
"@ | Set-Content -Path $NuGetConfigPath -Encoding UTF8
	}

	[xml]$nugetConfig = Get-Content -Path $NuGetConfigPath

	if (-not $nugetConfig.configuration.packageSources) {
		$packageSourcesNode = $nugetConfig.CreateElement("packageSources")
		$nugetConfig.configuration.AppendChild($packageSourcesNode) | Out-Null
	}

	if (-not $nugetConfig.configuration.packageSourceCredentials) {
		$credentialsNode = $nugetConfig.CreateElement("packageSourceCredentials")
		$nugetConfig.configuration.AppendChild($credentialsNode) | Out-Null
	}

	$existingSource = $nugetConfig.configuration.packageSources.add | Where-Object {
		$_.key -eq $SourceName
	}

	if ($existingSource) {
		$existingSource.value = $SourceUrl
	} else {
		$sourceNode = $nugetConfig.CreateElement("add")
		$sourceNode.SetAttribute("key", $SourceName)
		$sourceNode.SetAttribute("value", $SourceUrl)
		$nugetConfig.configuration.packageSources.AppendChild($sourceNode) | Out-Null
	}

	$existingCredentialNode = $nugetConfig.configuration.packageSourceCredentials.$SourceName

	if (-not $existingCredentialNode) {
		$existingCredentialNode = $nugetConfig.CreateElement($SourceName)
		$nugetConfig.configuration.packageSourceCredentials.AppendChild($existingCredentialNode) | Out-Null
	}

	$existingCredentialNode.RemoveAll()

	$usernameNode = $nugetConfig.CreateElement("add")
	$usernameNode.SetAttribute("key", "Username")
	$usernameNode.SetAttribute("value", "api-key")
	$existingCredentialNode.AppendChild($usernameNode) | Out-Null

	$passwordNode = $nugetConfig.CreateElement("add")
	$passwordNode.SetAttribute("key", "ClearTextPassword")
	$passwordNode.SetAttribute("value", "%$ApiKeyEnvVarName%")
	$existingCredentialNode.AppendChild($passwordNode) | Out-Null

	$nugetConfig.Save((Resolve-Path $NuGetConfigPath))

	Write-Host "Configured Telerik feed '$SourceName' in '$NuGetConfigPath'."
	Write-Host "Saved API key in user environment variable '$ApiKeyEnvVarName'."
	Write-Host "Restart your terminal/IDE so new processes can read the updated environment variable."
}

Example usage:

Configure-TelerikNuGetSource -ApiKey "<telerik-api-key>"

Changelog

1.1.0 - 2026-03-20

  • Added skill package metadata: required_binaries, author, homepage, and source.
  • Updated configure function to save API key as a user-level environment variable.
  • Updated nuget.config credential handling to use environment variable expansion instead of hardcoded API key values.
  • Added version field to frontmatter.

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-07 05:48 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

Docker Essentials

arnarsson
核心 Docker 命令和工作流程,包括容器管理、镜像操作和调试。
★ 38 📥 32,726
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 198 📥 68,330
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 687 📥 331,501