| 62 | } |
| 63 | |
| 64 | func updateCmd() *cobra.Command { |
| 65 | cmd := &cobra.Command{ |
| 66 | Use: "update-app --properties [raw-json-update-properties]", |
| 67 | Short: "Update application settings", |
| 68 | Long: heredoc.Doc(` |
| 69 | Update the application settings. |
| 70 | |
| 71 | Application level settings allow you to configure settings that |
| 72 | impact all the channel types in your app. |
| 73 | |
| 74 | See https://getstream.io/chat/docs/rest/#settings-updateapp for |
| 75 | the available JSON options. |
| 76 | `), |
| 77 | Example: heredoc.Doc(` |
| 78 | # Enable multi-tenant and update permission version to v2 |
| 79 | $ stream-cli chat update-app --properties '{"multi_tenant_enabled": true, "permission_version": "v2"}' |
| 80 | `), |
| 81 | RunE: func(cmd *cobra.Command, args []string) error { |
| 82 | c, err := config.GetConfig(cmd).GetClient(cmd) |
| 83 | if err != nil { |
| 84 | return err |
| 85 | } |
| 86 | |
| 87 | p, _ := cmd.Flags().GetString("properties") |
| 88 | |
| 89 | s := &stream.AppSettings{} |
| 90 | err = json.Unmarshal([]byte(p), s) |
| 91 | if err != nil { |
| 92 | return err |
| 93 | } |
| 94 | |
| 95 | _, err = c.UpdateAppSettings(cmd.Context(), s) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | |
| 100 | cmd.Println("Successfully updated app settings.") |
| 101 | return nil |
| 102 | }, |
| 103 | } |
| 104 | |
| 105 | fl := cmd.Flags() |
| 106 | fl.StringP("properties", "p", "", "[required] Raw json properties to update") |
| 107 | _ = cmd.MarkFlagRequired("properties") |
| 108 | |
| 109 | return cmd |
| 110 | } |
| 111 | |
| 112 | func revokeAllTokensCmd() *cobra.Command { |
| 113 | cmd := &cobra.Command{ |