mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
19 lines
492 B
Go
19 lines
492 B
Go
package proxyserver
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
|
||
|
|
"github.com/safedep/pmg/packagemanager"
|
||
|
|
)
|
||
|
|
|
||
|
|
// EnvVars returns the proxy environment variables (KEY=VALUE lines) for the
|
||
|
|
// running proxy described by the state file at statePath.
|
||
|
|
func EnvVars(statePath string) ([]string, error) {
|
||
|
|
state, err := readState(statePath)
|
||
|
|
if err != nil {
|
||
|
|
return nil, fmt.Errorf("proxy not running, start with 'pmg proxy start' first: %w", err)
|
||
|
|
}
|
||
|
|
|
||
|
|
return packagemanager.EnvVarForProxy(state.Addr, state.CACertPath), nil
|
||
|
|
}
|