Support Deployment to Heroku (#280)

* Added heroku.yml

* Added app.json

* PORT as env var
This commit is contained in:
dacousb 2021-09-19 21:03:01 +02:00 committed by GitHub
parent 567556711b
commit 350b796571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 2 deletions

42
app.json Normal file
View File

@ -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
heroku.yml Normal file
View File

@ -0,0 +1,3 @@
build:
docker:
web: Dockerfile

View File

@ -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...");