mirror of
https://github.com/openziti/zrok.git
synced 2025-08-19 04:06:18 +02:00
more shared scaffolding between 'zrok' and 'zrokloop' (#40)
This commit is contained in:
@@ -6,9 +6,19 @@ import (
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/openziti-test-kitchen/zrok/rest_client_zrok"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/pflag"
|
||||
"net/url"
|
||||
"os"
|
||||
)
|
||||
|
||||
func AddZrokApiEndpointFlag(v *string, flags *pflag.FlagSet) {
|
||||
defaultEndpoint := os.Getenv("ZROK_API_ENDPOINT")
|
||||
if defaultEndpoint == "" {
|
||||
defaultEndpoint = "https://api.zrok.io"
|
||||
}
|
||||
flags.StringVarP(v, "endpoint", "e", defaultEndpoint, "zrok API endpoint address")
|
||||
}
|
||||
|
||||
func ZrokClient(endpoint string) (*rest_client_zrok.Zrok, error) {
|
||||
apiUrl, err := url.Parse(endpoint)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user