Configuration file for SPFx Extension – Best practice

%3CLINGO-SUB%20id%3D%22lingo-sub-1263381%22%20slang%3D%22en-US%22%3EConfiguration%20file%20for%20SPFx%20Extension%20%E2%80%93%20Best%20practice%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1263381%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20am%20creating%20a%20SPFX%20extension%20to%20access%20lists%20and%20display%20the%20list%20data.%20I%20would%20like%20to%20have%20a%20configurable%20settings%20file%20where%20I%20can%20store%20to%20list%20name%20for%20different%20environment%20like%20dev%2C%20test%20and%20production%20and%20then%20access%20the%20value%20from%20the%20configuration%20file.%3C%2FP%3E%3CP%3EIs%20there%20a%20best%20practice%20for%20creating%20such%20configurations%20with%20regards%20to%20SPFx%20extensions%2Fweb%20parts%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EAkash%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1264039%22%20slang%3D%22en-US%22%3ERe%3A%20Configuration%20file%20for%20SPFx%20Extension%20%E2%80%93%20Best%20practice%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1264039%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EFor%20web%20parts%2C%20you%20can%20have%20configurable%20web%20part%20properties%20and%20using%20PnP%20property%20controls%2C%20you%20can%20allow%20the%20users%20to%20choose%20the%20list%20or%20you%20can%20even%20provision%20the%20list%20while%20adding%20the%20app%20to%20the%20site.%3CBR%20%2F%3EFor%20extension%2C%20its%20different%2C%20the%20properties%20are%20stored%20in%20the%20app%20catalog%2C%20if%20you%20still%20want%20to%20use%20different%20configs%20for%20different%20environment%2C%20I%20suggest%20you%20maintain%20a%20list%20and%20make%20sure%20the%20list%20exists%20in%20all%20the%20environment.%20But%20for%20the%20tenant-wide%20extensions%2C%20you%20have%20to%20maintain%20the%20configs%20as%20a%20properties%20which%20will%20be%20stored%20in%20the%20app%20catalog%20site.%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi,

I am creating a SPFX extension to access lists and display the list data. I would like to have a configurable settings file where I can store to list name for different environment like dev, test and production and then access the value from the configuration file.

Is there a best practice for creating such configurations with regards to SPFx extensions/web parts?

 

Regards,

Akash

1 Reply
Highlighted
Hi,
For web parts, you can have configurable web part properties and using PnP property controls, you can allow the users to choose the list or you can even provision the list while adding the app to the site.
For extension, its different, the properties are stored in the app catalog, if you still want to use different configs for different environment, I suggest you maintain a list and make sure the list exists in all the environment. But for the tenant-wide extensions, you have to maintain the configs as a properties which will be stored in the app catalog site.