either

package
v1.0.39 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveCredential

func ResolveCredential(env map[string]string) func(string) E.Either[error, C.Credential]

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

type CredentialService = func(string) E.Either[error, C.Credential]

service that solves a credential from a URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL