jetli / rust-yew-realworld-example-app

Exemplary real world app built with Rust + Yew + WebAssembly, by Function Components + Hooks, also supports desktop by Tauri.
https://jetli.github.io/rust-yew-realworld-example-app/
Apache License 2.0
862 stars 112 forks source link

Make the API root URL configurable #7

Closed LukeMathWalker closed 2 years ago

LukeMathWalker commented 4 years ago

Hey!

I was trying to run this frontend in combination with the Rust (Tide + Diesel) backend we wrote (https://github.com/colinbankier/realworld-tide) and I realised that it's currently impossible to configurable the URI of the backend, given that it's hard-coded as

const API_ROOT: &str = "https://conduit.productionready.io/api";

Would it be possible to make it configurable, either via a configuration file or an environment variable? It would be amazing to be able to give instructions to run a full Rust web-app, FE+BE, without having to ask the user to touch the source code :grin:

jetli commented 4 years ago

Great idea! A .env config should fit for this. I'll investigate it later.

jetli commented 4 years ago

Continue to investigate why new value of API_ROOT is not picked up when editing .env file to trigger a new build.