Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveCredential ¶
ResolveCredential resolves the credentials for accessing a URL based on an environment map
The key into the service needs to be a URL. The implementation will convert the URL into [constant case](https://www.npmjs.com/package/constant-case) and then tries to find environment variables with the suffix `_USERNAME` and `_PASSWORD`. It will fallback for the complete path up to the hostname. So to provide credentials in the environment for the URL `https://eu.artifactory.swg-devops.com/artifactory/api/npm/sys-zaas-team-dev-npm-virtual/` you can specify
```text EU_ARTIFACTORY_SWG_DEVOPS_COM_USERNAME=XXX EU_ARTIFACTORY_SWG_DEVOPS_COM_PASSWORD=YYY ``` as environment variables. The complete fallback path for the example is: ```text EU_ARTIFACTORY_SWG_DEVOPS_COM_ARTIFACTORY_API_NPM_SYS_ZAAS_TEAM_DEV_NPM_VIRTUAL_USERNAME EU_ARTIFACTORY_SWG_DEVOPS_COM_ARTIFACTORY_API_NPM_USERNAME EU_ARTIFACTORY_SWG_DEVOPS_COM_ARTIFACTORY_API_USERNAME EU_ARTIFACTORY_SWG_DEVOPS_COM_ARTIFACTORY_USERNAME EU_ARTIFACTORY_SWG_DEVOPS_COM_USERNAME
Types ¶
type CredentialService ¶
service that solves a credential from a URL
Click to show internal directories.
Click to hide internal directories.