r/Devvit App Developer 11d ago

Feature Request Please allow us to update app settings programmatically

Currently, app settings can only be updated in one of two ways: Either by using the app settings page on developers.reddit.com, or by using the Devvit CLI. I think it would be very useful to be able to update app settings programmatically, via a function such as reddit.setSetting() or some similar name.

An example of how this could be very beneficial is: Let's say one of my Mod Tools app's settings is a boolean value and I want to change it to a select, to give the user/mod more options. Ideally, I'd like to base the default value of that select setting on the previous value of the boolean setting, so that when the app is updated, it doesn't break the workflow for mods.

I also logged an "issue" on GitHub with this request, so if any admin likes this idea, feel free to use that ticket for tracking purposes.

16 Upvotes

7 comments sorted by

u/vip-bot 11d ago

There is 1 comment from Reddit Admins in this post:

u/​Xenccc commented:

Thank you for raising this! The ticket was flagged.


This summary was generated automatically. If you have any questions, please contact r/​Devvit moderators.

4

u/_GLAD0S_ App Developer 11d ago

Absolutely agree, there are a lot of use cases for this.

3

u/Xenccc Admin 11d ago

Thank you for raising this! The ticket was flagged.

2

u/Chosen1PR App Developer 11d ago

Yay! Thanks for looking into it.

1

u/PokeRestockHandler 8d ago

Im confused. I get changing true to false but changing a boolean to a different type is heavier and hints at reflection which is terrible for reliability

1

u/Chosen1PR App Developer 8d ago edited 8d ago

Sorry if I wasn't clear enough. For changing the setting type, I meant when updating the app, not during normal operation.

Hypothetical example: My app currently has a boolean setting which is just on/off. I decide I want more granular control over this setting so I change it to a select (drop-down) setting to give the user more options. I also rename the setting internally.

I then use the onAppUpdate trigger during an app update to search for the old boolean setting by name. If I find it, that means I'm updating from a version of the app that has that old setting. I can then update the value of the new select setting based on the old boolean value.

For example, if the new setting has values off, low, medium, and high, an old value of false would become off whereas an old value of true could become medium.

Edit: Now that I think of it, I'm not so sure the onAppUpdate trigger would have access to the old setting... Either way, I think you get where I'm going with this. I wasn't referring to changing setting types on the fly.

1

u/stonk_lord_ 6d ago

Maybe they should add a legacy attribute to the settings page. In devvit.json you should be able to add a "legacy" attribute to all settings that you no longer want the moderators to see when using your app, but you can still access those legacy settings via settings.get().

You can then simply update your new setting value based on whatever value you got from the legacy setting onappupdate