Skip to content

Commit

Permalink
setting uo of dstabase constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Kneatrum committed Aug 20, 2024
1 parent 522b51b commit 2730442
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
12 changes: 6 additions & 6 deletions back-end/database/db_delete.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
require('dotenv').config({ path: '../.env'});

const {InfluxDB} = require('@influxdata/influxdb-client')
const {InfluxDB} = require('@influxdata/influxdb-client');
const { DeleteAPI } = require('@influxdata/influxdb-client-apis');
const CONFIG = require('../../config.json');


const dbHost = CONFIG.influxdb.host;
const dbPort = CONFIG.influxdb.port;
const dbHost = 'influxdb';
const dbPort = 8086;

const token = process.env.INFLUXDB_API_TOKEN

const token = process.env.API_TOKEN
const url = "http://" + dbHost + ":" + dbPort;
const org = "kneatrum"
const org = process.env.ORG_NAME

const client = new InfluxDB({url, token})
const deleteAPI = new DeleteAPI(client)
Expand Down
14 changes: 6 additions & 8 deletions back-end/database/db_read.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@

require('dotenv').config({ path: '../.env' });
require('dotenv').config({ path: '../.env'});

const {InfluxDB} = require('@influxdata/influxdb-client')
const { measurements, devices, tags, fields} = require('../constants');
const CONFIG = require('../../config.json');

const dbHost = CONFIG.influxdb.host;
const dbPort = CONFIG.influxdb.port;
const dbHost = 'influxdb';
const dbPort = 8086;
const token = process.env.INFLUXDB_API_TOKEN;


const token = process.env.API_TOKEN
const url = "http://" + dbHost + ":" + dbPort;
const org = "kneatrum"
const bucket = "fitbit"
const org = process.env.ORG_NAME
const bucket = process.env.BUCKET_NAME

const client = new InfluxDB({url, token})

Expand Down
12 changes: 5 additions & 7 deletions back-end/database/db_write.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
require('dotenv').config({ path: '../.env' });

const {InfluxDB, Point} = require('@influxdata/influxdb-client')
const CONFIG = require('../../config.json');

const dbHost = CONFIG.influxdb.host;
const dbPort = CONFIG.influxdb.port;
const dbHost = 'influxdb';
const dbPort = 8086;
const org = process.env.ORG_NAME;
const bucket = process.env.BUCKET_NAME;
const token = process.env.INFLUXDB_API_TOKEN

const token = process.env.API_TOKEN
const url = "http://" + dbHost + ":" + dbPort;
let org = "kneatrum"
let bucket = "fitbit"

const client = new InfluxDB({url, token});

let writeClient = client.getWriteApi(org, bucket, 'ns');
Expand Down

0 comments on commit 2730442

Please sign in to comment.