using an external settings file for the openweathermap api key

This commit is contained in:
aminnairi
2023-04-10 23:17:22 +02:00
parent 79976df5fe
commit fdd23b89df
+14 -1
View File
@@ -1,11 +1,24 @@
import { URL } from "url";
import { request } from "https";
import { readFile } from "fs/promises";
import { cpus as cpuInfo } from "os";
import { cpus as cpuInfo, homedir } from "os";
import { exec } from "child_process";
import { createInterface } from "readline/promises";
import { stdin as input, stdout as output } from "process";
import { createRenderer } from "@aminnairi/i3status";
import { join } from "path";
// SETTINGS
const settings = await readFile(join(homedir(), ".config/i3/i3status/settings.json")).then(fileContent => {
return JSON.parse(fileContent);
}).catch(() => {
return {
weather: {
appid: ""
}
};
});
// HELPERS