You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refac(io) set IO once in main to allow overriding with in memory io in tests
`print.Printer` had a reference to a `cobra.Command` for using its IO
streams. Each Command also used a Printer, resulting in an awkward
circular dependency.
Refactored Printer to use IO streams directly. When using the application
these are set in `main`, when used in tests these can be set to
`bytes.Buffer`s.
Also replaced usages of `os.Args` with just a string slice. Also set
in `main`.
`cobra.Command`s `Args` and IO-streams are set in `NewRootCmd` with
`traverseCommands`.
`CmdParams` also has an `fs.FS`, currently unused but will allow using
the real FS during regular use and an in-memory-FS during tests.
This change prepares the application for integrative testing while keeping
good isolation. Generally speaking the goal is to move all things with
side effects into main (compare with https://grafana.com/blog/how-i-write-http-services-in-go-after-13-years/#func-main-only-calls-run)
* fix(fmt) run formatter
* fix(test) adapt cli args after changing arg slicing
* feat(secret flag) add reusable secret flag implementation, update guide
Had to split implementation into two parts: `Set()` and `SecretFlagToSP`.
Set is only called when an argument is specified on the command line.
So moving the `PromptForPassword` logic into `Set` does not work.
I'm not sure if the current solution with a specialized `*ToStringPointer`
func is the way to go. So I've only refactored `obs-credentials add`
as an example.
* fix(docs) generate docs
* fix(lint) fix linting errors
* fix(secretflag) use title case when printing flag usage
* fix(fmt) run formatter
* feat(secretflags) refactor password flags to use SecretFlag
- searched for 'password' and 'secret' to find usages
- checked usages of printer.PromptForPassword
-d, --displayname string Displayname for the credentials
24
24
-h, --help Help for "stackit beta alb observability-credentials update"
25
-
--password string Password. Can be a string or a file path, if prefixed with "@" (example: @./password.txt).
25
+
--password string Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
26
26
-u, --username string Username for the credentials
Copy file name to clipboardExpand all lines: docs/stackit_beta_cdn_distribution_create.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,7 @@ stackit beta cdn distribution create [flags]
35
35
--blocked-ips strings Comma-separated list of IPv4 addresses to block (e.g., '10.0.0.8,127.0.0.1')
36
36
--bucket Use Object Storage backend
37
37
--bucket-credentials-access-key-id string Access Key ID for Object Storage backend
38
+
--bucket-password string Bucket-Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
38
39
--bucket-region string Region for Object Storage backend
39
40
--bucket-url string Bucket URL for Object Storage backend
40
41
--default-cache-duration string ISO8601 duration string for default cache duration (e.g., 'PT1H30M' for 1 hour and 30 minutes)
@@ -44,6 +45,7 @@ stackit beta cdn distribution create [flags]
44
45
--http-origin-request-headers strings Origin request headers for HTTP backend in the format 'HeaderName: HeaderValue', repeatable. WARNING: do not store sensitive values in the headers!
45
46
--http-origin-url string Origin URL for HTTP backend
46
47
--loki Enable Loki log sink for the CDN distribution
48
+
--loki-password string Loki-Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
47
49
--loki-push-url string Push URL for log sink
48
50
--loki-username string Username for log sink
49
51
--monthly-limit-bytes int Monthly limit in bytes for the CDN distribution
Copy file name to clipboardExpand all lines: docs/stackit_beta_cdn_distribution_update.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ stackit beta cdn distribution update [flags]
24
24
--blocked-ips strings Comma-separated list of IPv4 addresses to block (e.g., '10.0.0.8,127.0.0.1')
25
25
--bucket Use Object Storage backend
26
26
--bucket-credentials-access-key-id string Access Key ID for Object Storage backend
27
+
--bucket-password string Bucket-Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
27
28
--bucket-region string Region for Object Storage backend
28
29
--bucket-url string Bucket URL for Object Storage backend
29
30
--default-cache-duration string ISO8601 duration string for default cache duration (e.g., 'PT1H30M' for 1 hour and 30 minutes)
@@ -33,6 +34,7 @@ stackit beta cdn distribution update [flags]
33
34
--http-origin-request-headers strings Origin request headers for HTTP backend in the format 'HeaderName: HeaderValue', repeatable. WARNING: do not store sensitive values in the headers!
34
35
--http-origin-url string Origin URL for HTTP backend
35
36
--loki Enable Loki log sink for the CDN distribution
37
+
--loki-password string Loki-Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
36
38
--loki-push-url string Push URL for log sink
37
39
--loki-username string Username for log sink
38
40
--monthly-limit-bytes int Monthly limit in bytes for the CDN distribution
Copy file name to clipboardExpand all lines: docs/stackit_beta_intake_user_create.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ stackit beta intake user create [flags]
28
28
-h, --help Help for "stackit beta intake user create"
29
29
--intake-id string The UUID of the Intake to associate the user with
30
30
--labels stringToString Labels in key=value format, separated by commas (default [])
31
-
--password string Password for the user. Must contain lower, upper, number, and special characters (min 12 chars)
31
+
--password string Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty. Must contain lower, upper, number, and special characters (min 12 chars)
32
32
--type string Type of user. One of 'intake' (default) or 'dead-letter' (default "intake")
-h, --help Help for "stackit beta intake user update"
29
29
--intake-id string Intake ID
30
30
--labels stringToString Labels in key=value format, separated by commas. Example: --labels "key1=value1,key2=value2". (default [])
31
-
--password string Password for the user. Must contain lower, upper, number, and special characters (min 12 chars)
31
+
--password string Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty. Must contain lower, upper, number, and special characters (min 12 chars)
32
32
--type string Type of user. One of 'intake' or 'dead-letter'
-h, --help Help for "stackit load-balancer observability-credentials add"
28
-
--password string Password. Can be a string or a file path, if prefixed with "@" (example: @./password.txt).
28
+
--password string Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
-h, --help Help for "stackit load-balancer observability-credentials update"
28
-
--password string Password. Can be a string or a file path, if prefixed with "@" (example: @./password.txt).
28
+
--password string Password. Can be a string (deprecated) or a file path, if prefixed with '@' (example: @./secret.txt). Will be read from stdin when empty.
cmd.Flags().Var(flags.EnumSliceFlag(false, []string{}, sdkUtils.EnumSliceToStringSlice(cdn.AllowedRegionEnumValues)...), flagRegion, fmt.Sprintf("Regions in which content should be cached, multiple of: %q", cdn.AllowedRegionEnumValues))
cmd.Flags().Var(flags.EnumSliceFlag(false, []string{}, sdkUtils.EnumSliceToStringSlice(cdn.AllowedRegionEnumValues)...), flagRegions, fmt.Sprintf("Regions in which content should be cached, multiple of: %q", cdn.AllowedRegionEnumValues))
0 commit comments