panic on start if env vars are not set
This commit is contained in:
		@@ -17,6 +17,13 @@ const STATUS_FILE: &str = "status.json";
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#[tokio::main]
 | 
					#[tokio::main]
 | 
				
			||||||
async fn main() {
 | 
					async fn main() {
 | 
				
			||||||
 | 
					    if env::var("consumer_key").is_err() {
 | 
				
			||||||
 | 
					        panic!("env var consumer_key must be set");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if env::var("consumer_secret").is_err() {
 | 
				
			||||||
 | 
					        panic!("env var consumer_secret must be set");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let app = Router::new()
 | 
					    let app = Router::new()
 | 
				
			||||||
        .route("/status.json", get(root))
 | 
					        .route("/status.json", get(root))
 | 
				
			||||||
        .route("/api/update", post(the_doors));
 | 
					        .route("/api/update", post(the_doors));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user