Vue.Starter icon indicating copy to clipboard operation
Vue.Starter copied to clipboard

Review Content Library directory resolution. Is there a better way that doesn't involve 10 different programming patterns?

Open robconery opened this issue 2 years ago • 3 comments

Right now the default is a hardcoded reference to the runtime location of the content: ./Content/ but I have a strong suspicion that this is going to break during deployment, interim builds or on Windows.

The default is overridable in the constructor but there has to be a better .NETty way of doing this. Would love your thoughts:

https://github.com/robconery/Vue.Starter/blob/main/templates/vue/server/Data/ContentLibrary.cs#L17

robconery avatar Feb 22 '23 20:02 robconery

I think environment variables are the easiest way to provide a value in this case especially if you want it to work well across various build systems. If an ENV var isn't supplied then the default or constructor override (if supplied) would win. Not sure if that's what you're asking exactly so if not let me know. :-)

DanWahlin avatar Feb 23 '23 00:02 DanWahlin

I was leaning in that direction but for some reason I hate ENV variables for directory settings. Unreasonable of me I guess. What about appsettings?

robconery avatar Feb 23 '23 20:02 robconery

I think appsettings works fine for that too. The reason I lean toward ENV vars is they’re outside of the app and easier to change in build systems. But, with something like a directory, it probably makes more sense to make them officially part of the app and appsettings makes that easy.

DanWahlin avatar Feb 23 '23 22:02 DanWahlin