CtxConfig pulls the current Config out of the context, or a blank Config if not set.
(ctx context.Context)
| 38 | // CtxConfig pulls the current Config out of the context, or a blank Config if |
| 39 | // not set. |
| 40 | func CtxConfig(ctx context.Context) *Config { |
| 41 | if c, ok := ctx.Value(contextKeyConfig).(*Config); ok { |
| 42 | return c |
| 43 | } |
| 44 | |
| 45 | // If it doesn't exist, return a new empty config for safety. |
| 46 | return NewConfig(memfs.New()) |
| 47 | } |
| 48 | |
| 49 | // CtxSetUser puts the given User into the ssh.Context. |
| 50 | func CtxSetUser(parent ssh.Context, user *User) { |