fix(gateway): make NOMAD_ALLOC_INDEX environment variable optional
This commit is contained in:
parent
6faed635fa
commit
a5af6793f8
@ -81,7 +81,7 @@ async fn init_gateway(
|
|||||||
if shard_count < 16 {
|
if shard_count < 16 {
|
||||||
scheme = ShardScheme::Auto;
|
scheme = ShardScheme::Auto;
|
||||||
} else {
|
} else {
|
||||||
let cluster_id = env::var("NOMAD_ALLOC_INDEX")?.parse::<u64>().unwrap();
|
let cluster_id = env::var("NOMAD_ALLOC_INDEX").or("0").parse::<u64>().unwrap();
|
||||||
let first_shard_id = 16 * cluster_id;
|
let first_shard_id = 16 * cluster_id;
|
||||||
|
|
||||||
scheme = ShardScheme::try_from((first_shard_id..first_shard_id+16, shard_count)).unwrap();
|
scheme = ShardScheme::try_from((first_shard_id..first_shard_id+16, shard_count)).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user