chore: better configs

This commit is contained in:
Vasily Zubarev
2025-05-02 11:47:36 +02:00
parent 26ab51f9d4
commit 6c3641c469
4 changed files with 50 additions and 47 deletions

View File

@@ -6,16 +6,17 @@ UPLOAD_PATH="./data/uploads"
DATABASE_URL="postgresql://user@localhost:5432/taxhacker" DATABASE_URL="postgresql://user@localhost:5432/taxhacker"
# You can put it here or the app will ask you to enter it # You can put it here or the app will ask you to enter it
OPENAI_API_KEY="" OPENAI_MODEL_NAME="gpt-4o-mini"
OPENAI_API_KEY="" # "sk-..."
# Auth Config # Auth Config
BETTER_AUTH_SECRET="random-secret-key" # please use any long random string here BETTER_AUTH_SECRET="random-secret-key" # please use any long random string here
# Stripe Configuration # Stripe Configuration
STRIPE_SECRET_KEY="" STRIPE_SECRET_KEY="" # "sk_live_..." or "sk_test_..."
STRIPE_WEBHOOK_SECRET="" STRIPE_WEBHOOK_SECRET="" # "whsec_..."
# Resend Configuration (optional, use if you want to send emails) # Resend Configuration (optional, use if you want to send emails)
RESEND_API_KEY="" RESEND_API_KEY="" # "re_..."
RESEND_AUDIENCE_ID="" RESEND_AUDIENCE_ID="" # "aud_..."
RESEND_FROM_EMAIL="TaxHacker <user@localhost>" RESEND_FROM_EMAIL="TaxHacker <user@localhost>"

View File

@@ -145,14 +145,15 @@ Configure TaxHacker to suit your needs with these environment variables:
| Variable | Required | Description | Example | | Variable | Required | Description | Example |
|----------|----------|-------------|---------| |----------|----------|-------------|---------|
| `PORT` | No | Port to run the app on | `7331` (default) |
| `UPLOAD_PATH` | Yes | Local directory for uploading files | `./data/uploads` | | `UPLOAD_PATH` | Yes | Local directory for uploading files | `./data/uploads` |
| `DATABASE_URL` | Yes | PostgreSQL connection string | `postgresql://user@localhost:5432/taxhacker` | | `DATABASE_URL` | Yes | PostgreSQL connection string | `postgresql://user@localhost:5432/taxhacker` |
| `SELF_HOSTED_MODE` | No | Set it to "true" if you're self-hosting the app: it enables auto-login, custom API keys, and more | `false` | | `PORT` | No | Port to run the app on | `7331` (default) |
| `BASE_URL` | No | Base URL for the application | `http://localhost:7331` |
| `SELF_HOSTED_MODE` | No | Set it to "true" if you're self-hosting the app: it enables auto-login, custom API keys, and more | `true` |
| `DISABLE_SIGNUP` | No | Disable new user registration on your instance | `false` | | `DISABLE_SIGNUP` | No | Disable new user registration on your instance | `false` |
| `BETTER_AUTH_SECRET` | Yes | Secret key for authentication (min 16 characters) | `random-secret-key` |
| `OPENAI_MODEL_NAME` | No | OpenAI model to use for AI features | `gpt-4o-mini` |
| `OPENAI_API_KEY` | No | OpenAI API key for AI features. In self-hosted mode you can set it up in settings too. | `sk-...` | | `OPENAI_API_KEY` | No | OpenAI API key for AI features. In self-hosted mode you can set it up in settings too. | `sk-...` |
| `RESEND_API_KEY` | No | Resend API key for email notifications | `re_...` |
| `RESEND_FROM_EMAIL` | No | Email address to send from | `TaxHacker <hello@taxhacker.app>` |
## ⌨️ Local Development ## ⌨️ Local Development

View File

@@ -244,6 +244,41 @@ export default function LandingPage() {
</h2> </h2>
</div> </div>
<div className="grid md:grid-cols-2 gap-16"> <div className="grid md:grid-cols-2 gap-16">
{/* Self-Hosted Version */}
<div className="bg-gradient-to-b from-white to-gray-50 p-8 rounded-2xl shadow-lg ring-1 ring-gray-100">
<div className="inline-block px-3 py-1 rounded-full bg-violet-50 text-violet-600 text-sm font-medium mb-4">
Use Your Own Server
</div>
<h3 className="text-2xl font-semibold mb-4">
<ColoredText>Self-Hosted Edition</ColoredText>
</h3>
<ul className="space-y-3 text-gray-600 mb-8">
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Free and open source
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Complete control over your data
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Use at your own infrastructure
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Bring your own OpenAI keys
</li>
</ul>
<Link
href="https://github.com/vas3k/TaxHacker"
target="_blank"
className="block w-full text-center px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-medium rounded-full hover:opacity-90 transition-all shadow-lg shadow-blue-500/20"
>
Github + Docker Compose
</Link>
</div>
{/* Cloud Version */} {/* Cloud Version */}
<div className="bg-gradient-to-b from-white to-gray-50 p-8 rounded-2xl shadow-lg ring-1 ring-gray-100"> <div className="bg-gradient-to-b from-white to-gray-50 p-8 rounded-2xl shadow-lg ring-1 ring-gray-100">
<div className="absolute top-4 right-4"> <div className="absolute top-4 right-4">
@@ -280,41 +315,6 @@ export default function LandingPage() {
LET'S GO! LET'S GO!
</Link> </Link>
</div> </div>
{/* Self-Hosted Version */}
<div className="bg-gradient-to-b from-white to-gray-50 p-8 rounded-2xl shadow-lg ring-1 ring-gray-100">
<div className="inline-block px-3 py-1 rounded-full bg-violet-50 text-violet-600 text-sm font-medium mb-4">
Use Your Own Server
</div>
<h3 className="text-2xl font-semibold mb-4">
<ColoredText>Self-Hosted Edition</ColoredText>
</h3>
<ul className="space-y-3 text-gray-600 mb-8">
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Free and open source
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Complete control over your data
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Use at your own infrastructure
</li>
<li className="flex items-center">
<span className="text-blue-600 mr-2"></span>
Bring your own OpenAI keys
</li>
</ul>
<Link
href="https://github.com/vas3k/TaxHacker"
target="_blank"
className="block w-full text-center px-6 py-3 bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-medium rounded-full hover:opacity-90 transition-all shadow-lg shadow-blue-500/20"
>
Github + Docker Compose
</Link>
</div>
</div> </div>
</div> </div>
</section> </section>

View File

@@ -3,8 +3,9 @@ import { z } from "zod"
const envSchema = z.object({ const envSchema = z.object({
BASE_URL: z.string().url().default("http://localhost:7331"), BASE_URL: z.string().url().default("http://localhost:7331"),
PORT: z.string().default("7331"), PORT: z.string().default("7331"),
SELF_HOSTED_MODE: z.enum(["true", "false"]).default("false"), SELF_HOSTED_MODE: z.enum(["true", "false"]).default("true"),
OPENAI_API_KEY: z.string().optional(), OPENAI_API_KEY: z.string().optional(),
OPENAI_MODEL_NAME: z.string().default("gpt-4o-mini"),
BETTER_AUTH_SECRET: z BETTER_AUTH_SECRET: z
.string() .string()
.min(16, "Auth secret must be at least 16 characters") .min(16, "Auth secret must be at least 16 characters")
@@ -22,7 +23,7 @@ const env = envSchema.parse(process.env)
const config = { const config = {
app: { app: {
title: "TaxHacker", title: "TaxHacker",
description: "Your personal AI helper for taxes", description: "Your personal AI accountant",
version: process.env.npm_package_version || "0.0.1", version: process.env.npm_package_version || "0.0.1",
baseURL: env.BASE_URL || `http://localhost:${env.PORT || "7331"}`, baseURL: env.BASE_URL || `http://localhost:${env.PORT || "7331"}`,
supportEmail: "me@vas3k.com", supportEmail: "me@vas3k.com",
@@ -37,7 +38,7 @@ const config = {
}, },
ai: { ai: {
openaiApiKey: env.OPENAI_API_KEY, openaiApiKey: env.OPENAI_API_KEY,
modelName: "gpt-4o-mini", modelName: env.OPENAI_MODEL_NAME,
}, },
auth: { auth: {
secret: env.BETTER_AUTH_SECRET, secret: env.BETTER_AUTH_SECRET,