Skip to content

Commit 8bff21a

Browse files
authored
Merge pull request #244 from objectstack-ai/copilot/fix-sign-up-error
2 parents f4953a6 + 073669f commit 8bff21a

File tree

3 files changed

+110
-1
lines changed

3 files changed

+110
-1
lines changed

.env.example

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ─── ObjectStack Authentication Configuration ──────────────────────────────
2+
3+
# Required: Secret key for session encryption and JWT signing
4+
# Generate a secure random string (e.g., using `openssl rand -base64 32`)
5+
AUTH_SECRET=your-super-secret-key-change-this-in-production
6+
7+
# Optional: Base URL for the application (defaults to http://localhost:5320)
8+
# BETTER_AUTH_URL=http://localhost:5320
9+
10+
# ─── Database Configuration ─────────────────────────────────────────────────
11+
12+
# Optional: Database connection URL (defaults to SQLite: objectstack.db)
13+
# Examples:
14+
# - PostgreSQL: postgres://user:password@localhost:5432/objectstack
15+
# - MongoDB: mongodb://localhost:27017/objectstack
16+
# - SQLite: sqlite:objectstack.db (or omit for default)
17+
# OBJECTQL_DATABASE_URL=sqlite:objectstack.db
18+
19+
# ─── OAuth Provider Configuration ───────────────────────────────────────────
20+
21+
# Google OAuth
22+
# GOOGLE_CLIENT_ID=your-google-client-id
23+
# GOOGLE_CLIENT_SECRET=your-google-client-secret
24+
25+
# GitHub OAuth
26+
# GITHUB_CLIENT_ID=your-github-client-id
27+
# GITHUB_CLIENT_SECRET=your-github-client-secret
28+
29+
# Microsoft OAuth
30+
# MICROSOFT_CLIENT_ID=your-microsoft-client-id
31+
# MICROSOFT_CLIENT_SECRET=your-microsoft-client-secret
32+
33+
# ─── Enterprise SSO Configuration ───────────────────────────────────────────
34+
35+
# Microsoft Entra ID (Azure AD)
36+
# AZURE_AD_CLIENT_ID=your-azure-client-id
37+
# AZURE_AD_CLIENT_SECRET=your-azure-client-secret
38+
# AZURE_AD_TENANT_ID=your-azure-tenant-id
39+
40+
# Auth0
41+
# AUTH0_CLIENT_ID=your-auth0-client-id
42+
# AUTH0_CLIENT_SECRET=your-auth0-client-secret
43+
# AUTH0_DOMAIN=your-tenant.auth0.com
44+
45+
# Okta
46+
# OKTA_CLIENT_ID=your-okta-client-id
47+
# OKTA_CLIENT_SECRET=your-okta-client-secret
48+
# OKTA_ISSUER=https://your-domain.okta.com
49+
50+
# Keycloak
51+
# KEYCLOAK_CLIENT_ID=your-keycloak-client-id
52+
# KEYCLOAK_CLIENT_SECRET=your-keycloak-client-secret
53+
# KEYCLOAK_ISSUER=https://your-keycloak-server/realms/your-realm
54+
55+
# ─── Two-Factor Authentication ──────────────────────────────────────────────
56+
57+
# Optional: 2FA issuer name (defaults to "ObjectStack")
58+
# BETTER_AUTH_2FA_ISSUER=ObjectStack
59+
60+
# ─── Server Configuration ───────────────────────────────────────────────────
61+
62+
# Server port (defaults to 5320)
63+
# PORT=5320
64+
65+
# CORS origins (comma-separated, defaults to http://localhost:5321,http://localhost:5320)
66+
# CORS_ORIGINS=http://localhost:5321,http://localhost:5320
67+
68+
# Log level (defaults to 'info')
69+
# LOG_LEVEL=info

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,37 @@ cd objectos
144144
pnpm install
145145
```
146146

147+
### Environment Setup
148+
149+
Before running the application, you need to configure environment variables. Copy the example file and update it with your settings:
150+
151+
```bash
152+
cp .env.example .env
153+
```
154+
155+
**Required Configuration:**
156+
157+
At minimum, you need to set the `AUTH_SECRET` for authentication to work:
158+
159+
```bash
160+
# Generate a secure random secret (32+ characters recommended)
161+
export AUTH_SECRET=$(openssl rand -base64 32)
162+
```
163+
164+
Or add it to your `.env` file:
165+
166+
```env
167+
AUTH_SECRET=your-super-secret-key-change-this-in-production
168+
```
169+
170+
**Optional Configuration:**
171+
172+
- **Database**: Defaults to SQLite (`objectstack.db`). Set `OBJECTQL_DATABASE_URL` for PostgreSQL or MongoDB.
173+
- **OAuth Providers**: Configure `GOOGLE_CLIENT_ID`, `GITHUB_CLIENT_ID`, etc. for social login.
174+
- **Enterprise SSO**: Set up Auth0, Okta, Keycloak, or Azure AD via environment variables.
175+
176+
See `.env.example` for all available options.
177+
147178
### Development
148179

149180
```bash

objectstack.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ export default defineStack({
6666
new StoragePlugin(),
6767

6868
// Core
69-
new AuthPlugin(),
69+
new AuthPlugin({
70+
secret: process.env.AUTH_SECRET || (() => {
71+
const defaultSecret = 'dev-secret-change-in-production-min-32-chars';
72+
if (process.env.NODE_ENV === 'production') {
73+
console.error('WARNING: Using default AUTH_SECRET in production! Set AUTH_SECRET environment variable.');
74+
}
75+
return defaultSecret;
76+
})(),
77+
baseUrl: process.env.BETTER_AUTH_URL || 'http://localhost:5320',
78+
}),
7079
new PermissionsPlugin(),
7180
new AuditLogPlugin(),
7281

0 commit comments

Comments
 (0)