netrc
Generate a .netrc auto-login configuration file that provides a secure authenticationapproach 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@723df11baa358c8ca700cd6f4636319f811b729c
Entrypoint
Return Type
Netrc !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
format | Enum ! | "compact" | the format when generating the auto-login configuration file (compact,full) |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@723df11baa358c8ca700cd6f4636319f811b729c 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
Name | Type | Default Value | Description |
---|---|---|---|
machine | String ! | - | the remote machine name |
username | Secret ! | - | a user on the remote machine that can login |
password | Secret ! | - | a token (or password) used to login into a remote machine by the identified user |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@723df11baa358c8ca700cd6f4636319f811b729c 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
Name | Type | Default Value | Description |
---|---|---|---|
cfg | File ! | - | an existing auto-login configuration file |
Example
dagger -m github.com/purpleclay/daggerverse/netrc@723df11baa358c8ca700cd6f4636319f811b729c 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@723df11baa358c8ca700cd6f4636319f811b729c 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
Name | Type | Default Value | Description |
---|---|---|---|
name | String | - | 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@723df11baa358c8ca700cd6f4636319f811b729c 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()
}