-
Notifications
You must be signed in to change notification settings - Fork 1
/
meta.go
36 lines (31 loc) · 1.04 KB
/
meta.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"flag"
"github.com/duaraghav8/okta-admin/command"
"os"
)
// createMeta returns the Metadata object to be passed to
// all actions. None of the global options are treated as
// required. Checking for emptiness of an option and
// further validations are therefore the user's responsibility.
func createMeta() (*command.Metadata, error) {
var (
meta command.Metadata
globalOpts command.Config
)
flags := flag.NewFlagSet("options", flag.ContinueOnError)
flags.StringVar(&globalOpts.OrgUrl, "org-url", os.Getenv("OKTA_ORG_URL"), "")
flags.StringVar(&globalOpts.ApiToken, "api-token", os.Getenv("OKTA_API_TOKEN"), "")
meta = command.Metadata{
FlagSet: flags,
GlobalOptions: &globalOpts,
GlobalOptionsHelpText: `
Global Options:
-org-url Okta organization URL
This can also be specified via the OKTA_ORG_URL environment variable.
-api-token Token to authenticate with Okta API
This can also be specified via the OKTA_API_TOKEN environment variable.
`,
}
return &meta, nil
}