Skip to content

Commit

Permalink
Support Deployment to Heroku (#280)
Browse files Browse the repository at this point in the history
* Added heroku.yml

* Added app.json

* PORT as env var
  • Loading branch information
dacousb authored Sep 19, 2021
1 parent 5675567 commit 350b796
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
42 changes: 42 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
3 changes: 3 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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...");

Expand Down

0 comments on commit 350b796

Please sign in to comment.