Skip to content

Commit

Permalink
[server] systemd config env var fix, handle schema env var with bette…
Browse files Browse the repository at this point in the history
…r errors
  • Loading branch information
hwchen committed Dec 5, 2018
1 parent d404dc4 commit 9e6a935
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tesseract-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ fn main() -> Result<(), Error> {
.or(opt.clickhouse_db_url.ok_or(format_err!("")))
.expect("No Clickhouse DB url found");
let schema_path = env::var("TESSERACT_SCHEMA_FILEPATH")
.clone()
.unwrap_or("schema.json".to_owned());
.expect("TESSERACT_SCHEMA_FILEPATH not found");

// Initialize Clickhouse
let ch_options = ChOptions::new(
Expand All @@ -57,7 +56,8 @@ fn main() -> Result<(), Error> {
);

// Initialize Schema
let schema_str = std::fs::read_to_string(&schema_path)?;
let schema_str = std::fs::read_to_string(&schema_path)
.map_err(|_| format_err!("Schema file not found at {}", schema_path))?;
let schema = Schema::from_json(&schema_str)?;

// Initialize Server
Expand Down
2 changes: 1 addition & 1 deletion tesseract-server/tesseract.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Type=simple
RemainAfterExit=yes
Environment=RUST_LOG=info
Environment=CLICKHOUSE_DATABASE_URL=127.0.0.1:9000
Environment=TESSERACT_SCHEMA_PATH=schema.json
Environment=TESSERACT_SCHEMA_FILEPATH=schema.json
ExecStart=tesseract
TimeoutSec=600

Expand Down

0 comments on commit 9e6a935

Please sign in to comment.