strapi-plugin-preview-content
strapi-plugin-preview-content copied to clipboard
Set preview URL in configuration file
Hello! First, let me thank you for the great work on this plugin, it helped me a lot in previewing content using strapi.
I am opening this issue to check if I am missig something and it is possible to set the preview URL in a configuration file so it can be tracked in version control instead of setting it in the Strapi admin interface and being kept in the DB.
If it in fact is not possible, I would like to leave it as a suggestion, because it would remove any manual work from deploys (at least mine), and I suspect this could be the case for others too.
From quickly looking at the plugin code I imagine it would take adding some logic to check if a value exists in the strapi config object in the 'getPreviewUrl' function in the file 'src/services/preview.ts'. The config value could be set in the file 'plugins' config file in strapi or something similar.
Anyway, I could make a pull request if you're interested in the suggestion, and thanks again for your work on this plugin :smiley:
Hey @lordalaqua that's a really great suggestion!! If you can make the PR i will review it and merge it ASAP
Hi! Sorry for the delay, I am a little busy right now, but as soon as I can I will make a PR implementing this idea!
I just realized there is an issue of priority, whether the value from the database or from the config file would be used in case both are set. I would choose to prioritize the value from the DB and if it's not set then use the config file, but if you disagree let me know what you think and I can make it differently when I do it.
I love that proposal, go ahead i will be watching the notifications to see if there is an update
Hi @danestves, I also like the idea about setting the URL in a config file. In case this feature will be implemented, would it be also possible to set the default for previewable (initial false) here too. Our strapi system runs on docker in a cloud environment and it is unhandy to change files on filesystem to enable previewable for new content models here. Many thanks and greetings.
Hi @escv this edit for previewable is made only to work in development, because is the same way as Strapi works, you can't create or edit files if the environment is not local because is like Strapi works
Hi @lordalaqua, @pr0gr8mm3r made some improvements to the code here https://github.com/danestves/strapi-plugin-preview-content/pull/21, maybe that can help you with your idea