subliminal 0.0.4

Base crate for subliminal microservices project
Documentation
use std::env::{self, VarError};

use log::error;

pub mod errors;
pub mod message_queue;
pub mod task;

// Code generation modules
#[path = "submodules/subliminal-protos-rust/src/db.rs"]
pub mod database;

// Get the port to serve the service on
pub fn get_serve_port() -> Result<String, VarError> {
    env::var("PORT").map_err(|e| {
        error!("PORT environment variable is required!");
        e
    })
}

// Get the Google Cloud Project ID from the environment for use in various places
pub fn get_google_project_id() -> Result<String, VarError> {
    env::var("GOOGLE_PROJECT_ID").map_err(|e| {
        error!("GOOGLE_PROJECT_ID environment variable is required!");
        e
    })
}

// Get the Google Cloud PubSub topic ID for users to queue task updates for processing
pub fn get_google_execution_updates_topic_id() -> Result<String, VarError> {
    env::var("GOOGLE_EXECUTION_UPDATES_TOPIC_ID").map_err(|e| {
        error!("GOOGLE_EXECUTION_UPDATES_TOPIC_ID environment variable is required!");
        e
    })
}