Use public URL instead of URL in configuration

Change the name of the `url` config key to `public_url` to be more clear
about what it is for.
This commit is contained in:
Paul van Tilburg 2022-10-17 19:47:29 +02:00
parent fa8fc40b58
commit bde6135f70
Signed by: paul
GPG Key ID: C6DE073EDA9EEC4D
5 changed files with 9 additions and 9 deletions

View File

@ -25,7 +25,7 @@ builds when you don't add `--release`.)
### Configuration ### Configuration
For now, you will need to provide Rocket with configuration to tell it at which For now, you will need to provide Rocket with configuration to tell it at which
URL Podbringer is hosted. This needs to be done even if you are not using a public URL Podbringer is hosted. This needs to be done even if you are not using a
reverse proxy, in which case you need to provide it with the proxied URL. You reverse proxy, in which case you need to provide it with the proxied URL. You
can also use the configuration to configure a different address and/or port. can also use the configuration to configure a different address and/or port.
Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`): Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
@ -34,7 +34,7 @@ Just create a `Rocket.toml` file that contains (or copy `Rocket.toml.example`):
[default] [default]
address = "0.0.0.0" address = "0.0.0.0"
port = 7062 port = 7062
url = "https://my.domain.tld/podbringer" public_url = "https://my.domain.tld/podbringer"
``` ```
This will work independent of the type of build. For more about Rocket's This will work independent of the type of build. For more about Rocket's
@ -52,7 +52,7 @@ need to use for Podbringer is comprised of the following parts:
```text ```text
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband
|------------------------------| |-------||--------------| |------------------------------| |-------||--------------|
The Podbringer location URL Service User @ service The Podbringer public URL Service User @ service
``` ```
### Feed item limit ### Feed item limit

View File

@ -1,4 +1,4 @@
[default] [default]
address = "0.0.0.0" address = "0.0.0.0"
port = 7062 port = 7062
url = "https://my.domain.tld/podbringer" public_url = "https://my.domain.tld/podbringer"

View File

@ -92,7 +92,7 @@ fn construct_item(
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let url = uri!( let url = uri!(
Absolute::parse(&config.url).expect("valid URL"), Absolute::parse(&config.public_url).expect("valid URL"),
crate::get_download(backend_id = backend_id, file = item.enclosure.file) crate::get_download(backend_id = backend_id, file = item.enclosure.file)
); );
let enclosure = EnclosureBuilder::default() let enclosure = EnclosureBuilder::default()

View File

@ -69,9 +69,9 @@ pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, Deserialize, Serialize)] #[derive(Debug, Deserialize, Serialize)]
#[serde(crate = "rocket::serde")] #[serde(crate = "rocket::serde")]
pub(crate) struct Config { pub(crate) struct Config {
/// The URL at which the application is hosted or proxied from. /// The public URL at which the application is hosted or proxied from.
#[serde(default)] #[serde(default)]
url: String, public_url: String,
} }
/// A Rocket responder wrapper type for RSS feeds. /// A Rocket responder wrapper type for RSS feeds.
@ -107,7 +107,7 @@ async fn get_feed(
/// Returns a simple index page that explains the usage. /// Returns a simple index page that explains the usage.
#[get("/")] #[get("/")]
pub(crate) async fn get_index(config: &State<Config>) -> Template { pub(crate) async fn get_index(config: &State<Config>) -> Template {
Template::render("index", context! { url: &config.url }) Template::render("index", context! { url: &config.public_url })
} }
/// Sets up Rocket. /// Sets up Rocket.

View File

@ -11,7 +11,7 @@
<pre> <pre>
https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband https://my.domain.tld/podbringer/feed/mixcloud/myfavouriteband
|------------------------------| |-------||--------------| |------------------------------| |-------||--------------|
The Podbringer location URL Service User @ service The Podbringer public URL Service User @ service
</pre> </pre>
</p> </p>
<p> <p>