Dagger
Search

netrc

Generate a .netrc auto-login configuration file that provides a secure authentication
approach for transparently authenticating against a remote machine. Tools like Git provide
out-of-the-box support for a .netrc auto-login configuration file, making accessing
private repositories painless, especially for languages such as Go. The generated .netrc
file can (and should) be mounted as a dedicated secret to avoid caching.

Installation

dagger install github.com/purpleclay/daggerverse/netrc@v0.2.0

Entrypoint

Return Type
Netrc !
Example
dagger -m github.com/purpleclay/daggerverse/netrc@9c4f2bbbfa3e087d11f32ff40c38b6f2e3896f10 call \
func (m *myModule) example() *Netrc  {
	return dag.
			Netrc()
}
@function
def example() -> dag.Netrc:
	return (
		dag.netrc()
	)
@func()
example(): Netrc {
	return dag
		.netrc()
}

Types

Netrc 🔗

Netrc dagger module

withLogin() 🔗

Configures an auto-login configuration for a remote machine with the given credentials. Can be chained to configure multiple auto-logins in a single pass

Return Type
Netrc !
Arguments
NameTypeDefault ValueDescription
machineString !-the remote machine name
usernameString !-a user on the remote machine that can login
passwordSecret !-a token (or password) used to login into a remote machine by the identified user
Example
dagger -m github.com/purpleclay/daggerverse/netrc@9c4f2bbbfa3e087d11f32ff40c38b6f2e3896f10 call \
 with-login --machine string --username string --password env:MYSECRET
func (m *myModule) example(machine string, username string, password *Secret) *Netrc  {
	return dag.
			Netrc().
			WithLogin(machine, username, password)
}
@function
def example(machine: str, username: str, password: dagger.Secret) -> dag.Netrc:
	return (
		dag.netrc()
		.with_login(machine, username, password)
	)
@func()
example(machine: string, username: string, password: Secret): Netrc {
	return dag
		.netrc()
		.withLogin(machine, username, password)
}

withFile() 🔗

Loads an existing auto-login configuration from a file. Can be chained to load multiple configuration files in a single pass

Return Type
Netrc !
Arguments
NameTypeDefault ValueDescription
cfgFile !-an existing auto-login configuration file
Example
dagger -m github.com/purpleclay/daggerverse/netrc@9c4f2bbbfa3e087d11f32ff40c38b6f2e3896f10 call \
 with-file --cfg file:path
func (m *myModule) example(cfg *File) *Netrc  {
	return dag.
			Netrc().
			WithFile(cfg)
}
@function
def example(cfg: dagger.File) -> dag.Netrc:
	return (
		dag.netrc()
		.with_file(cfg)
	)
@func()
example(cfg: File): Netrc {
	return dag
		.netrc()
		.withFile(cfg)
}

asFile() 🔗

Generates and returns a .netrc file based on the current configuration

Return Type
File !
Example
dagger -m github.com/purpleclay/daggerverse/netrc@9c4f2bbbfa3e087d11f32ff40c38b6f2e3896f10 call \
 as-file
func (m *myModule) example() *File  {
	return dag.
			Netrc().
			AsFile()
}
@function
def example() -> dagger.File:
	return (
		dag.netrc()
		.as_file()
	)
@func()
example(): File {
	return dag
		.netrc()
		.asFile()
}

asSecret() 🔗

Generates and returns a .netrc file based on the current configuration that can be mounted as a secret to a container

Return Type
Secret !
Arguments
NameTypeDefault ValueDescription
nameString -a name for the generated secret, defaults to netrc-x, where x is the md5 hash of the auto-login configuration
Example
dagger -m github.com/purpleclay/daggerverse/netrc@9c4f2bbbfa3e087d11f32ff40c38b6f2e3896f10 call \
 as-secret
func (m *myModule) example() *Secret  {
	return dag.
			Netrc().
			AsSecret()
}
@function
def example() -> dagger.Secret:
	return (
		dag.netrc()
		.as_secret()
	)
@func()
example(): Secret {
	return dag
		.netrc()
		.asSecret()
}