mirror of
https://github.com/aminnairi/dotfiles.git
synced 2026-09-14 13:22:13 +02:00
using an external settings file for the openweathermap api key
This commit is contained in:
+14
-1
@@ -1,11 +1,24 @@
|
|||||||
import { URL } from "url";
|
import { URL } from "url";
|
||||||
import { request } from "https";
|
import { request } from "https";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
import { cpus as cpuInfo } from "os";
|
import { cpus as cpuInfo, homedir } from "os";
|
||||||
import { exec } from "child_process";
|
import { exec } from "child_process";
|
||||||
import { createInterface } from "readline/promises";
|
import { createInterface } from "readline/promises";
|
||||||
import { stdin as input, stdout as output } from "process";
|
import { stdin as input, stdout as output } from "process";
|
||||||
import { createRenderer } from "@aminnairi/i3status";
|
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
|
// HELPERS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user