Changing to 0.0.0.0, fixing docker. Fixes #53

This commit is contained in:
Dessalines 2019-02-26 18:59:30 -08:00
parent 9558cc6a50
commit a83daf379b
4 changed files with 9 additions and 7 deletions

View File

@ -1,7 +1,6 @@
FROM node:10-jessie as node
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
ARG TORRENTS_CSV_ENDPOINT
COPY server/ui /app/server/ui
RUN cd /app/server/ui && yarn && yarn build

View File

@ -5,10 +5,11 @@ services:
build:
context: .
args:
TORRENTS_CSV_ENDPOINT: http://0.0.0.0:8080
TORRENTS_CSV_ENDPOINT: http://0.0.0.0:8088
command: /bin/sh -c /app/torrents-csv-service
ports:
- "8080:8080"
environment:
TORRENTS_CSV_DB_FILE: /app/torrents.db
TORRENTS_CSV_FRONT_END_DIR: /app/dist
TORRENTS_CSV_ENDPOINT: 0.0.0.0:8080

View File

@ -13,7 +13,7 @@ use std::ops::Deref;
use rusqlite::{Connection};
fn main() {
println!("Access me at http://localhost:8080");
println!("Access me at {}", endpoint());
server::new(|| {
App::new()
.route("/service/search", http::Method::GET, search)
@ -22,10 +22,9 @@ fn main() {
"/static",
fs::StaticFiles::new(front_end_dir())
.unwrap()
// .index_file("index.html"),
)
.finish()
}).bind("localhost:8080")
}).bind(endpoint())
.unwrap()
.run();
}
@ -42,6 +41,9 @@ fn torrents_db_file() -> String {
env::var("TORRENTS_CSV_DB_FILE").unwrap_or("../../torrents.db".to_string())
}
fn endpoint() -> String {
env::var("TORRENTS_CSV_ENDPOINT").unwrap_or("0.0.0.0:8080".to_string())
}
#[derive(Deserialize)]
struct SearchQuery {
q: String,

View File

@ -2,7 +2,7 @@ require('dotenv').config();
const fs = require('fs');
exports.setEnv = function() {
let endpoint = (process.env.TORRENTS_CSV_ENDPOINT) ? process.env.TORRENTS_CSV_ENDPOINT : "http://localhost:8080";
let endpoint = (process.env.TORRENTS_CSV_ENDPOINT) ? process.env.TORRENTS_CSV_ENDPOINT : "http://0.0.0.0:8080";
let env_line = `export const endpoint = '${endpoint}';`;
fs.writeFile("src/env.ts", env_line, function (err) {
console.log("Wrote src/env.ts:");