mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 11:19:12 +01:00
* WIP On docker integration * WIP on adding docker support * WIP on adding docker support * chore: Add cacheTime parameter to createCacheChannel function * bugfix: Add node-loader npm dependency for webpack configuration * revert changes * chore: Add node-loader npm dependency for webpack configuration * feat: Add Docker container list to DockerPage * chore: apply pr suggestions * fix: fix printing issue using a Date objext * chore: Update npm dependencies * feat: Create DockerTable component for displaying Docker container list * feat: Refactor DockerPage to use DockerTable component * feat: Refactor DockerPage to use DockerTable component * feat: Add useTimeAgo hook for displaying relative timestamps * feat: Add hooks module to common package * refactor: Update DockerTable component Include container actions and state badges * feat: add information about instance for docker containers * feat: Add OverflowBadge component for displaying overflowed data * feat: Refactor DockerSingleton to use host and instance properties This commit refactors the DockerSingleton class in the `docker.ts` file to use the `host` and `instance` properties instead of the previous `key` and `remoteApi` properties. This change improves clarity and consistency in the codebase. * feat: Add OverflowBadge component for displaying overflowed data * feat: Improve DockerTable component with Avatar and Name column This commit enhances the DockerTable component in the `DockerTable.tsx` file by adding an Avatar and Name column. The Avatar column displays an icon based on the Docker container's image, while the Name column shows the container's name. This improvement provides better visual representation and identification of the containers in the table. * feat: Enhance DockerTable component with Avatar and Name columns * refactor: improve docker table and icon resolution * chore: address pull request feedback * fix: format issues * chore: add missing translations * refactor: remove black background --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
62 lines
2.4 KiB
JavaScript
62 lines
2.4 KiB
JavaScript
import { createEnv } from "@t3-oss/env-nextjs";
|
|
import { z } from "zod";
|
|
|
|
const isUsingDbUrl = Boolean(process.env.DB_URL);
|
|
const isUsingDbHost = Boolean(process.env.DB_HOST);
|
|
const isUsingDbCredentials = process.env.DB_DRIVER === "mysql2";
|
|
|
|
export const env = createEnv({
|
|
shared: {
|
|
VERCEL_URL: z
|
|
.string()
|
|
.optional()
|
|
.transform((url) => (url ? `https://${url}` : undefined)),
|
|
PORT: z.coerce.number().default(3000),
|
|
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
|
|
},
|
|
/**
|
|
* Specify your server-side environment variables schema here. This way you can ensure the app isn't
|
|
* built with invalid env vars.
|
|
*/
|
|
server: {
|
|
DB_DRIVER: z.enum(["better-sqlite3", "mysql2"]).default("better-sqlite3"),
|
|
// If the DB_HOST is set, the DB_URL is optional
|
|
DB_URL: isUsingDbHost ? z.string().optional() : z.string(),
|
|
DB_HOST: isUsingDbUrl ? z.string().optional() : z.string(),
|
|
DB_PORT: isUsingDbUrl ? z.number().optional() : z.number().min(1).default(3306),
|
|
DB_USER: isUsingDbCredentials ? z.string() : z.string().optional(),
|
|
DB_PASSWORD: isUsingDbCredentials ? z.string() : z.string().optional(),
|
|
DB_NAME: isUsingDbUrl ? z.string().optional() : z.string(),
|
|
// Comma separated list of docker hostnames that can be used to connect to query the docker endpoints (localhost:2375,host.docker.internal:2375, ...)
|
|
DOCKER_HOSTNAMES: z.string().optional(),
|
|
DOCKER_PORTS: z.number().optional(),
|
|
},
|
|
/**
|
|
* Specify your client-side environment variables schema here.
|
|
* For them to be exposed to the client, prefix them with `NEXT_PUBLIC_`.
|
|
*/
|
|
client: {
|
|
// NEXT_PUBLIC_CLIENTVAR: z.string(),
|
|
},
|
|
/**
|
|
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away.
|
|
*/
|
|
runtimeEnv: {
|
|
VERCEL_URL: process.env.VERCEL_URL,
|
|
PORT: process.env.PORT,
|
|
DB_URL: process.env.DB_URL,
|
|
DB_HOST: process.env.DB_HOST,
|
|
DB_USER: process.env.DB_USER,
|
|
DB_PASSWORD: process.env.DB_PASSWORD,
|
|
DB_NAME: process.env.DB_NAME,
|
|
DB_PORT: process.env.DB_PORT,
|
|
DB_DRIVER: process.env.DB_DRIVER,
|
|
NODE_ENV: process.env.NODE_ENV,
|
|
DOCKER_HOSTNAMES: process.env.DOCKER_HOSTNAMES,
|
|
DOCKER_PORTS: process.env.DOCKER_PORTS,
|
|
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
|
|
},
|
|
skipValidation:
|
|
Boolean(process.env.CI) || Boolean(process.env.SKIP_ENV_VALIDATION) || process.env.npm_lifecycle_event === "lint",
|
|
});
|