mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
fix: only set NOMAD_ALLOC_INDEX as node_id when other cluster config is present
This commit is contained in:
parent
35ce4e8da2
commit
79f7c973e7
3 changed files with 8 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ WORKDIR /build
|
||||||
|
|
||||||
RUN apk add rustup build-base protoc
|
RUN apk add rustup build-base protoc
|
||||||
# todo: arm64 target
|
# todo: arm64 target
|
||||||
RUN rustup-init --default-host x86_64-unknown-linux-musl --default-toolchain stable --profile default -y
|
RUN rustup-init --default-host x86_64-unknown-linux-musl --default-toolchain nightly-2024-08-20 --profile default -y
|
||||||
|
|
||||||
ENV PATH=/root/.cargo/bin:$PATH
|
ENV PATH=/root/.cargo/bin:$PATH
|
||||||
ENV RUSTFLAGS='-C link-arg=-s'
|
ENV RUSTFLAGS='-C link-arg=-s'
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ pub struct DiscordConfig {
|
||||||
pub bot_token: String,
|
pub bot_token: String,
|
||||||
pub client_secret: String,
|
pub client_secret: String,
|
||||||
pub max_concurrency: u32,
|
pub max_concurrency: u32,
|
||||||
|
#[serde(default)]
|
||||||
pub cluster: Option<ClusterSettings>,
|
pub cluster: Option<ClusterSettings>,
|
||||||
pub api_base_url: Option<String>,
|
pub api_base_url: Option<String>,
|
||||||
|
|
||||||
|
|
@ -81,8 +82,11 @@ fn _json_log_default() -> bool {
|
||||||
pub struct PKConfig {
|
pub struct PKConfig {
|
||||||
pub db: DatabaseConfig,
|
pub db: DatabaseConfig,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
pub discord: Option<DiscordConfig>,
|
pub discord: Option<DiscordConfig>,
|
||||||
|
#[serde(default)]
|
||||||
pub api: Option<ApiConfig>,
|
pub api: Option<ApiConfig>,
|
||||||
|
#[serde(default)]
|
||||||
pub avatars: Option<AvatarsConfig>,
|
pub avatars: Option<AvatarsConfig>,
|
||||||
|
|
||||||
#[serde(default = "_metrics_default")]
|
#[serde(default = "_metrics_default")]
|
||||||
|
|
@ -105,7 +109,8 @@ impl PKConfig {
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub static ref CONFIG: Arc<PKConfig> = {
|
pub static ref CONFIG: Arc<PKConfig> = {
|
||||||
if let Ok(var) = std::env::var("NOMAD_ALLOC_INDEX") {
|
if let Ok(var) = std::env::var("NOMAD_ALLOC_INDEX")
|
||||||
|
&& std::env::var("pluralkit__discord__cluster__total_nodes").is_ok() {
|
||||||
std::env::set_var("pluralkit__discord__cluster__node_id", var);
|
std::env::set_var("pluralkit__discord__cluster__node_id", var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#![feature(let_chains)]
|
||||||
use metrics_exporter_prometheus::PrometheusBuilder;
|
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue