To make it easier while I work on a bizarre split setup, store the influx url and the host IP separately.

This commit is contained in:
Herbert Wolverson committed 2023-04-20 20:02:34 +00:00
1 parent 07dc9c0745
commit e75dbca434
3 files changed
+5 -2

No files matched your search

+1
View File
@@ -58,6 +58,7 @@ src/dist
src/rust/lqos_anonymous_stats_server/anonymous.sqlite
src/rust/long_term_stats/license_server/lqkeys.bin
src/rust/long_term_stats/lts_node/lqkeys.bin
src/rust/long_term_stats/pgdb/.env
# Ignore Rust build artifacts
src/rust/target
@@ -23,7 +23,8 @@ CREATE TABLE public.shaper_nodes (
CREATE TABLE public.stats_hosts (
id integer NOT NULL,
ip_address character varying(128) NOT NULL,
can_accept_new_clients boolean NOT NULL DEFAULT true
can_accept_new_clients boolean NOT NULL DEFAULT true,
influx_host character varying(128) NOT NULL
);
CREATE SEQUENCE public.stats_hosts_id_seq
+2 -1
View File
@@ -27,10 +27,11 @@ pub async fn add_stats_host(cnn: Pool<Postgres>, hostname: String) -> Result<i64
// Insert the stats host
log::info!("Inserting new stats host: {} ({})", hostname, new_id);
sqlx::query("INSERT INTO stats_hosts (id, ip_address, can_accept_new_clients) VALUES ($1, $2, $3)")
sqlx::query("INSERT INTO stats_hosts (id, ip_address, can_accept_new_clients, influx_host) VALUES ($1, $2, $3, $4)")
.bind(new_id)
.bind(&hostname)
.bind(true)
.bind(&hostname)
.execute(&cnn)
.await
.map_err(|e| StatsHostError::DatabaseError(e.to_string()))?;