diff --git a/app.json b/app.json new file mode 100644 index 0000000..8573671 --- /dev/null +++ b/app.json @@ -0,0 +1,42 @@ +{ + "name": "Libreddit", + "description": "Private front-end for Reddit", + "buildpacks": [ + { + "url": "https://github.com/emk/heroku-buildpack-rust" + }, + { + "url": "emk/rust" + } + ], + "stack": "container", + "env": { + "LIBREDDIT_DEFAULT_THEME": { + "required": false + }, + "LIBREDDIT_DEFAULT_FRONT_PAGE": { + "required": false + }, + "LIBREDDIT_DEFAULT_LAYOUT": { + "required": false + }, + "LIBREDDIT_DEFAULT_WIDE": { + "required": false + }, + "LIBREDDIT_DEFAULT_COMMENT_SORT": { + "required": false + }, + "LIBREDDIT_DEFAULT_POST_SORT": { + "required": false + }, + "LIBREDDIT_DEFAULT_SHOW_NSFW": { + "required": false + }, + "LIBREDDIT_USE_HLS": { + "required": false + }, + "LIBREDDIT_HIDE_HLS_NOTIFICATION": { + "required": false + } + } +} diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..8eec25b --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + web: Dockerfile diff --git a/src/main.rs b/src/main.rs index 786ce68..aa44e63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,10 +133,11 @@ async fn main() { .get_matches(); let address = matches.value_of("address").unwrap_or("0.0.0.0"); - let port = matches.value_of("port").unwrap_or("8080"); + let port = std::env::var("PORT") + .unwrap_or_else(|_| matches.value_of("port").unwrap_or("8080").to_string()); let hsts = matches.value_of("hsts"); - let listener = [address, ":", port].concat(); + let listener = [address, ":", &port].concat(); println!("Starting Libreddit...");