Skip to content

Commit

Permalink
mount_ssh_auth_sock
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Sep 14, 2024
1 parent 22d4aee commit abdaaeb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/staxfile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export default class Staxfile {
if (name.startsWith('stax.')) return this.fetchConfigValue(name)
else if (name === 'read') return this.read(args[0], args[1])
else if (name == 'mount_workspace') return this.mountWorkspace()
else if (name == 'mount_ssh_auth_sock') return this.mountSshAuthSock()
else if (name == 'path.resolve') return path.resolve(args[0])
else if (name == 'user') return process.env.USER
else if (name == 'user_id') return process.getuid()
Expand All @@ -107,12 +108,21 @@ export default class Staxfile {
return `${src}:${dest}`
}

private mountSshAuthSock() {
return process.platform === 'darwin' ?
'${{ stax.ssh_auth_sock }}:${{ stax.ssh_auth_sock }}' :
'${{ stax.host_services }}:/run/host-services'
}

private fetchConfigValue(name) {
const key = name.slice(5) // strip 'stax.' prefix

if (key == 'host_services')
return process.env.STAX_HOST_SERVICES

if (key == 'ssh_auth_sock')
return '/run/host-services/ssh-auth.sock'

if (!this.config.hasProperty(key)) {
if (name == 'config.workspace_volume' && !this.location.local)
this.warnings.add(`A '${name}' name must be defined when setting up from a remote source.`)
Expand Down

0 comments on commit abdaaeb

Please sign in to comment.