Skip to content

Commit

Permalink
build args
Browse files Browse the repository at this point in the history
  • Loading branch information
sinamics committed Apr 7, 2023
1 parent 907afde commit 9207eef
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
Empty file modified .devcontainer/init-cmd.sh
100755 → 100644
Empty file.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions init-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});

Expand All @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 9207eef

Please sign in to comment.