cmd/uplink: add note about share not-after/not-before flags formats

https://storjlabs.atlassian.net/browse/V3-3588

Change-Id: I43075155370c7e31ffee253b0f7169d7dee92c80
This commit is contained in:
Michal Niewrzal 2020-01-24 10:14:46 +01:00 committed by Ivan Fraixedes
parent 746c07cb91
commit 416e5053a3

View File

@ -27,8 +27,8 @@ var shareCfg struct {
DisallowDeletes bool `default:"false" help:"if true, disallow deletes" basic-help:"true"`
Readonly bool `default:"false" help:"implies disallow_writes and disallow_deletes" basic-help:"true"`
Writeonly bool `default:"false" help:"implies disallow_reads and disallow_lists" basic-help:"true"`
NotBefore string `help:"disallow access before this time" basic-help:"true"`
NotAfter string `help:"disallow access after this time" basic-help:"true"`
NotBefore string `help:"disallow access before this time (e.g. '+2h', '2020-01-02T15:01:01-01:00')" basic-help:"true"`
NotAfter string `help:"disallow access after this time (e.g. '+2h', '2020-01-02T15:01:01-01:00')" basic-help:"true"`
AllowedPathPrefix []string `help:"whitelist of path prefixes to require, overrides the [allowed-path-prefix] arguments"`
ExportTo string `default:"" help:"path to export the shared access to" basic-help:"true"`
@ -50,8 +50,6 @@ func init() {
process.Bind(shareCmd, &shareCfg, defaults, cfgstruct.ConfDir(getConfDir()))
}
const shareISO8601 = "2006-01-02T15:04:05-0700"
func parseHumanDate(date string, now time.Time) (*time.Time, error) {
switch {
case date == "":
@ -67,7 +65,7 @@ func parseHumanDate(date string, now time.Time) (*time.Time, error) {
t := now.Add(-d)
return &t, errs.Wrap(err)
default:
t, err := time.Parse(shareISO8601, date)
t, err := time.Parse(time.RFC3339, date)
return &t, errs.Wrap(err)
}
}