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.3.0

Entrypoint

Return Type
Netrc !
Arguments
NameTypeDefault ValueDescription
formatEnum !"compact"the format when generating the auto-login configuration file (compact,full)
Example
dagger -m github.com/purpleclay/daggerverse/netrc@3893340aa32e2140d6181124740f0a0a23e59588 call \
func (m *myModule) example(format ) *Netrc  {
	return dag.
			Netrc(format)
}
@function
def example(format: ) -> dag.Netrc:
	return (
		dag.netrc(format)
	)
@func()
example(format: ): Netrc {
	return dag
		.netrc(format)
}

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
usernameSecret !-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@3893340aa32e2140d6181124740f0a0a23e59588 call \
 with-login --machine string --username env:MYSECRET --password env:MYSECRET
func (m *myModule) example(format , machine string, username *Secret, password *Secret) *Netrc  {
	return dag.
			Netrc(format).
			WithLogin(machine, username, password)
}
@function
def example(format: , machine: str, username: dagger.Secret, password: dagger.Secret) -> dag.Netrc:
	return (
		dag.netrc(format)
		.with_login(machine, username, password)
	)
@func()
example(format: , machine: string, username: Secret, password: Secret): Netrc {
	return dag
		.netrc(format)
		.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@3893340aa32e2140d6181124740f0a0a23e59588 call \
 with-file --cfg file:path
func (m *myModule) example(format , cfg *File) *Netrc  {
	return dag.
			Netrc(format).
			WithFile(cfg)
}
@function
def example(format: , cfg: dagger.File) -> dag.Netrc:
	return (
		dag.netrc(format)
		.with_file(cfg)
	)
@func()
example(format: , cfg: File): Netrc {
	return dag
		.netrc(format)
		.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@3893340aa32e2140d6181124740f0a0a23e59588 call \
 as-file
func (m *myModule) example(format ) *File  {
	return dag.
			Netrc(format).
			AsFile()
}
@function
def example(format: ) -> dagger.File:
	return (
		dag.netrc(format)
		.as_file()
	)
@func()
example(format: ): File {
	return dag
		.netrc(format)
		.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@3893340aa32e2140d6181124740f0a0a23e59588 call \
 as-secret
func (m *myModule) example(format ) *Secret  {
	return dag.
			Netrc(format).
			AsSecret()
}
@function
def example(format: ) -> dagger.Secret:
	return (
		dag.netrc(format)
		.as_secret()
	)
@func()
example(format: ): Secret {
	return dag
		.netrc(format)
		.asSecret()
}