From 9207eefd2dcf4e807a15f0f8e2c35db5ae4e061c Mon Sep 17 00:00:00 2001 From: Bernt Christian Egeland Date: Fri, 7 Apr 2023 12:59:50 +0200 Subject: [PATCH] build args --- .devcontainer/init-cmd.sh | 0 README.md | 15 ++++++--------- init-db.sh | 1 + src/env.mjs | 2 -- src/utils/global.ts | 2 +- 5 files changed, 8 insertions(+), 12 deletions(-) mode change 100755 => 100644 .devcontainer/init-cmd.sh diff --git a/.devcontainer/init-cmd.sh b/.devcontainer/init-cmd.sh old mode 100755 new mode 100644 diff --git a/README.md b/README.md index ce3ae29b..563eea79 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,18 @@ With Next ZTNet, you can: ## Table of Contents -- [Next ZTNet](#next-ztnet) - - [⚠️ This is a work in progress. It is not ready for production use!](#️-this-is-a-work-in-progress-it-is-not-ready-for-production-use) +- [Next ZTnet](#next-ztnet) + - [⚠️ This project is currently under development and not yet suitable for production environments.](#️-this-project-is-currently-under-development-and-not-yet-suitable-for-production-environments) - [Table of Contents](#table-of-contents) - [Features](#features) - [Installations](#installations) - [Using Docker Compose](#using-docker-compose) - [Note! First user that register will be automatically assigned as admin.](#note-first-user-that-register-will-be-automatically-assigned-as-admin) - [Environment Variables](#environment-variables) - - [Development](#development) - - [vscode container development (recommended)](#vscode-container-development-recommended) - - [traditional development](#the-traditional-way) +- [Development](#development) + - [vscode container development (recommended)](#vscode-container-development-recommended) + - [The traditional way](#the-traditional-way) + - [Setup Environment Variables](#setup-environment-variables) ## Features @@ -98,7 +99,6 @@ services: POSTGRES_DB: postgres NEXTAUTH_URL: "http://localhost:3000" NEXTAUTH_SECRET: "random_secret" - NEXT_PUBLIC_SITE_NAME: "Next ZTNet" networks: - app-network links: @@ -140,14 +140,12 @@ The `docker-compose.yml` file includes several environment variables that you ca - `POSTGRES_DB`: The name of the PostgreSQL database. - `NEXTAUTH_URL`: The URL for NextAuth authentication. - `NEXTAUTH_SECRET`: The secret key for NextAuth authentication. -- `NEXT_PUBLIC_SITE_NAME`: Site name used in the Next.js application. These are system environment variables used by the ZeroTier service and should not be changed: - `ZT_OVERRIDE_LOCAL_CONF`: Allows overriding local ZeroTier configuration. - `ZT_ALLOW_MANAGEMENT_FROM`: Defines the IP range allowed to access the ZeroTier management interface. - `ZT_ADDR`: The address of the ZeroTier service. -- `NEXT_PUBLIC_CLIENTVAR`: A public client variable used by the Next.js application. To change any of these values, update the corresponding environment variable in the `docker-compose.yml` file. @@ -185,7 +183,6 @@ Create a `.env` file in the root of the project and set the necessary environmen - `POSTGRES_DB`=ztnet - `NEXTAUTH_URL`=http://localhost:3000 - `NEXTAUTH_SECRET`="your_nextauth_secret" -- `NEXT_PUBLIC_SITE_NAME`="Next ZTNet" - `MIGRATE_POSTGRES_DB`="shaddow_ztnet" - `MIGRATE_DATABASE_URL`="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${MIGRATE_POSTGRES_DB}?schema=public" You need to run the following command to create the database: diff --git a/init-db.sh b/init-db.sh index 1c826f08..3583f37a 100644 --- a/init-db.sh +++ b/init-db.sh @@ -8,6 +8,7 @@ cmd="$@" cat << EOF > .env DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public ZT_ADDR=${ZT_ADDR} +NEXT_PUBLIC_APP_VERSION=${NEXT_PUBLIC_APP_VERSION} EOF # config diff --git a/src/env.mjs b/src/env.mjs index 90030f6f..2c99baba 100644 --- a/src/env.mjs +++ b/src/env.mjs @@ -27,7 +27,6 @@ const server = z.object({ */ const client = z.object({ // NEXT_PUBLIC_CLIENTVAR: z.string().min(1), - NEXT_PUBLIC_SITE_NAME: z.string().optional(), NEXT_PUBLIC_APP_VERSION: z.string().optional(), }); @@ -42,7 +41,6 @@ const processEnv = { NODE_ENV: process.env.NODE_ENV, NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET, NEXTAUTH_URL: process.env.NEXTAUTH_URL, - NEXT_PUBLIC_SITE_NAME: process.env.NEXT_PUBLIC_SITE_NAME, NEXT_PUBLIC_APP_VERSION: process.env.NEXT_PUBLIC_APP_VERSION, // NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR, }; diff --git a/src/utils/global.ts b/src/utils/global.ts index 43438335..affcea21 100644 --- a/src/utils/global.ts +++ b/src/utils/global.ts @@ -3,6 +3,6 @@ import { env } from "~/env.mjs"; // If it is not set, use the default value "Next ZTnet". -export const globalSiteTitle = env.NEXT_PUBLIC_SITE_NAME || "Next ZTnet"; +export const globalSiteTitle = "Next ZTnet"; export const globalSiteVersion = env.NEXT_PUBLIC_APP_VERSION || null;