cmd/uplink: recommend notAfter expiration caveat be set

The auth service has no way to remove access grant registrations that
lack expiration dates.  We want to encourage people to set them, so as
to slow the rate at which the auth service DB fills up.

Change-Id: I1ccf629cd995dc184d2d90333166eab34d34ae07
This commit is contained in:
Bill Thorp 2021-07-09 14:14:54 -04:00 committed by Bill Thorp
parent 22e88c8f0a
commit 18c3252025

View File

@ -63,13 +63,25 @@ func init() {
func shareMain(cmd *cobra.Command, args []string) (err error) {
ctx, _ := withTelemetry(cmd)
isPublic := (shareCfg.Public || shareCfg.URL || shareCfg.DNS != "")
if isPublic {
if shareCfg.NotAfter == "" {
fmt.Println("It's not recommended to create a shared Access without an expiration date.")
fmt.Println("If you wish to do so anyway, please run this command with --not-after=none.")
return
}
if shareCfg.NotAfter == "none" {
shareCfg.NotAfter = ""
}
}
newAccess, newAccessData, sharePrefixes, permission, err := createAccessGrant(args)
if err != nil {
return err
}
if shareCfg.Register || shareCfg.URL || shareCfg.DNS != "" {
isPublic := (shareCfg.Public || shareCfg.URL || shareCfg.DNS != "")
accessKey, secretKey, endpoint, err := RegisterAccess(ctx, newAccess, shareCfg.AuthService, isPublic, defaultAccessRegisterTimeout)
if err != nil {
return err