chore(gladys): format description.md

This commit is contained in:
Nicolas Meienberger 2023-04-03 23:25:19 +02:00
parent 70b00b809e
commit 8eace9c01d
3 changed files with 43 additions and 58 deletions

View File

@ -1,5 +1,5 @@
import fs from "fs";
import jsyaml from "js-yaml";
import fs from 'fs';
import jsyaml from 'js-yaml';
interface AppConfig {
id: string;
@ -18,17 +18,11 @@ interface AppConfig {
available: boolean;
}
const networkExceptions = [
"pihole",
"tailscale",
"homeassistant",
"plex",
"zerotier",
];
const networkExceptions = ['pihole', 'tailscale', 'homeassistant', 'plex', 'zerotier', 'gladys'];
const getAppConfigs = (): AppConfig[] => {
const apps: AppConfig[] = [];
const appsDir = fs.readdirSync("./apps");
const appsDir = fs.readdirSync('./apps');
appsDir.forEach((app: string) => {
const path = `./apps/${app}/config.json`;
@ -42,7 +36,7 @@ const getAppConfigs = (): AppConfig[] => {
apps.push(config);
}
} catch (e) {
console.error("Error parsing config file", app);
console.error('Error parsing config file', app);
}
}
});
@ -50,14 +44,14 @@ const getAppConfigs = (): AppConfig[] => {
return apps;
};
describe("App configs", () => {
it("Get app config should return at least one app", () => {
describe('App configs', () => {
it('Get app config should return at least one app', () => {
const apps = getAppConfigs();
expect(apps.length).toBeGreaterThan(0);
});
it("Each app should have an id", () => {
it('Each app should have an id', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -65,7 +59,7 @@ describe("App configs", () => {
});
});
it("Each app should have a md description", () => {
it('Each app should have a md description', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -81,7 +75,7 @@ describe("App configs", () => {
});
});
it("Each app should have categories defined as an array", () => {
it('Each app should have categories defined as an array', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -90,7 +84,7 @@ describe("App configs", () => {
});
});
it("Each app should have a name", () => {
it('Each app should have a name', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -98,7 +92,7 @@ describe("App configs", () => {
});
});
it("Each app should have a description", () => {
it('Each app should have a description', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -106,7 +100,7 @@ describe("App configs", () => {
});
});
it("Each app should have a port", () => {
it('Each app should have a port', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -116,19 +110,19 @@ describe("App configs", () => {
});
});
it("Each app should have a different port", () => {
it('Each app should have a different port', () => {
const appConfigs = getAppConfigs();
const ports = appConfigs.map((app) => app.port);
expect(new Set(ports).size).toBe(appConfigs.length);
});
it("Each app should have a unique id", () => {
it('Each app should have a unique id', () => {
const appConfigs = getAppConfigs();
const ids = appConfigs.map((app) => app.id);
expect(new Set(ids).size).toBe(appConfigs.length);
});
it("Each app should have a version", () => {
it('Each app should have a version', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -137,7 +131,7 @@ describe("App configs", () => {
});
});
it("Each app should have a docker-compose file beside it", () => {
it('Each app should have a docker-compose file beside it', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -145,7 +139,7 @@ describe("App configs", () => {
});
});
it("Each app should have a metadata folder beside it", () => {
it('Each app should have a metadata folder beside it', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -153,7 +147,7 @@ describe("App configs", () => {
});
});
it("Each app should have a file named logo.jpg in the metadata folder", () => {
it('Each app should have a file named logo.jpg in the metadata folder', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
@ -161,13 +155,11 @@ describe("App configs", () => {
});
});
it("Each app should have a container name equals to its id", () => {
it('Each app should have a container name equals to its id', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
const dockerComposeFile = fs
.readFileSync(`./apps/${app.id}/docker-compose.yml`)
.toString();
const dockerComposeFile = fs.readFileSync(`./apps/${app.id}/docker-compose.yml`).toString();
const dockerCompose: any = jsyaml.load(dockerComposeFile);
@ -180,14 +172,12 @@ describe("App configs", () => {
});
});
it("Each app should have network tipi_main_network", () => {
it('Each app should have network tipi_main_network', () => {
const apps = getAppConfigs();
apps.forEach((app) => {
if (!networkExceptions.includes(app.id)) {
const dockerComposeFile = fs
.readFileSync(`./apps/${app.id}/docker-compose.yml`)
.toString();
const dockerComposeFile = fs.readFileSync(`./apps/${app.id}/docker-compose.yml`).toString();
const dockerCompose: any = jsyaml.load(dockerComposeFile);
@ -198,9 +188,7 @@ describe("App configs", () => {
}
expect(dockerCompose.services[app.id].networks).toBeDefined();
expect(dockerCompose.services[app.id].networks).toStrictEqual([
"tipi_main_network",
]);
expect(dockerCompose.services[app.id].networks).toStrictEqual(['tipi_main_network']);
}
});
});

View File

@ -1,4 +1,4 @@
version: "3"
version: '3'
services:
gladys:
@ -9,22 +9,20 @@ services:
stop_grace_period: 1m
network_mode: host
environment:
- NODE_ENV=production
- SERVER_PORT=8270
- TZ=${TZ}
- SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db
- NODE_ENV=production
- SERVER_PORT=8270
- TZ=${TZ}
- SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${APP_DATA_DIR}/data/gladysassistant:/var/lib/gladysassistant
- /dev:/dev
- /run/udev:/run/udev:ro
- /var/run/docker.sock:/var/run/docker.sock
- ${APP_DATA_DIR}/data/gladysassistant:/var/lib/gladysassistant
- /dev:/dev
- /run/udev:/run/udev:ro
# Not Exposing like Home Assitant
#labels:
#traefik.enable: ${APP_EXPOSED}
#traefik.http.routers.gladys.rule: Host(`${APP_DOMAIN}`)
#traefik.http.routers.gladys.entrypoints: websecure
#traefik.http.routers.gladys.service: gladys
#traefik.http.routers.gladys.tls.certresolver: myresolver
#traefik.http.services.gladys.loadbalancer.server.port: 8270
#labels:
#traefik.enable: ${APP_EXPOSED}
#traefik.http.routers.gladys.rule: Host(`${APP_DOMAIN}`)
#traefik.http.routers.gladys.entrypoints: websecure
#traefik.http.routers.gladys.service: gladys
#traefik.http.routers.gladys.tls.certresolver: myresolver
#traefik.http.services.gladys.loadbalancer.server.port: 8270

View File

@ -1,4 +1,3 @@
# [![](https://camo.githubusercontent.com/b344c2958123d48c50b994207ea6ed266b77c01646437bf3b607f14787cbedb8/68747470733a2f2f676c61647973617373697374616e742e636f6d2f656e2f696d672f65787465726e616c2f6769746875622d676c616479732d6c6f676f2e706e67)](https://camo.githubusercontent.com/b344c2958123d48c50b994207ea6ed266b77c01646437bf3b607f14787cbedb8/68747470733a2f2f676c61647973617373697374616e742e636f6d2f656e2f696d672f65787465726e616c2f6769746875622d676c616479732d6c6f676f2e706e67)
Gladys Assistant
## [Read the Docs](https://gladysassistant.com/docs/)
@ -17,6 +16,6 @@ To get started and install Gladys Assistant, you'll find everything on [our webs
## [](https://github.com/gladysassistant/gladys#articles)Articles
- [EN: Interview in Console #107](https://console.substack.com/p/console-104)
- [EN: Hackster.io - Gladys Assistant Is a Privacy-First Smart Home Platform — and Now Installable in Raspberry Pi Imager](https://www.hackster.io/news/gladys-assistant-is-a-privacy-first-smart-home-platform-and-now-installable-in-raspberry-pi-imager-4a84d5559c63)
- [FR: Framboise 314 - Plus de 500 installations pour lassistant domotique Gladys !](https://www.framboise314.fr/plus-de-500-installation-pour-lassistant-domotique-gladys/)
- [EN: Interview in Console #107](https://console.substack.com/p/console-104)
- [EN: Hackster.io - Gladys Assistant Is a Privacy-First Smart Home Platform — and Now Installable in Raspberry Pi Imager](https://www.hackster.io/news/gladys-assistant-is-a-privacy-first-smart-home-platform-and-now-installable-in-raspberry-pi-imager-4a84d5559c63)
- [FR: Framboise 314 - Plus de 500 installations pour lassistant domotique Gladys !](https://www.framboise314.fr/plus-de-500-installation-pour-lassistant-domotique-gladys/)