From a5af6793f8d05ba212ca65fccbfba155f756e3db Mon Sep 17 00:00:00 2001 From: spiral Date: Tue, 19 Apr 2022 16:17:10 -0400 Subject: [PATCH] fix(gateway): make NOMAD_ALLOC_INDEX environment variable optional --- gateway/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway/src/main.rs b/gateway/src/main.rs index c457ed83..1afaef4f 100644 --- a/gateway/src/main.rs +++ b/gateway/src/main.rs @@ -81,7 +81,7 @@ async fn init_gateway( if shard_count < 16 { scheme = ShardScheme::Auto; } else { - let cluster_id = env::var("NOMAD_ALLOC_INDEX")?.parse::().unwrap(); + let cluster_id = env::var("NOMAD_ALLOC_INDEX").or("0").parse::().unwrap(); let first_shard_id = 16 * cluster_id; scheme = ShardScheme::try_from((first_shard_id..first_shard_id+16, shard_count)).unwrap();