Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env-export-swagger
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AUTH_SESSION_SECRET=super-secret-key

DB_TYPE=sqlite

VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000
FRONTEND_URL=http://localhost:4200

SMTP_SERVICE=SMTP
Expand All @@ -27,4 +27,4 @@ LOG_LEVELS=error,warn,log,debug
PLUGIN_DIR=./storage/plugins

STATIC_FRONTEND_FILE_PATH=dist/apps/frontend
STATIC_DOCS_FILE_PATH=docs
STATIC_DOCS_FILE_PATH=docs
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AUTH_SESSION_SECRET=<super-secret-key>

DB_TYPE=sqlite

VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000
FRONTEND_URL=http://localhost:4200

SMTP_SERVICE=SMTP
Expand Down
4 changes: 2 additions & 2 deletions .env.serve
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ AUTH_SESSION_SECRET=super-secret-key
DB_TYPE=sqlite

# HTTP
VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000
FRONTEND_URL=http://localhost:4200
# HTTPS
#SSL_GENERATE_SELF_SIGNED_CERTIFICATES=true
#VITE_ATTRACCESS_URL=https://192.168.178.91
#VITE_FABACCESS_URL=https://192.168.178.91

SMTP_SERVICE=SMTP
SMTP_HOST=localhost
Expand Down
10 changes: 5 additions & 5 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ AUTH_JWT_SECRET=test-secret-key
AUTH_SESSION_SECRET=test-session-secret

DB_TYPE=sqlite
DB_FILE=e2e.attraccess.sqlite
DB_FILE=e2e.fabaccess.sqlite

VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000
FRONTEND_URL=http://localhost:4200

# Mailpit configuration
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_USER=no-reply@attraccess.local
SMTP_USER=no-reply@fabaccess.local
SMTP_PASS=
SMTP_FROM=no-reply@attraccess.local
SMTP_FROM=no-reply@fabaccess.local
SMTP_SECURE=false

LOG_LEVELS=
#log,warn,error,debug,info

STORAGE_PATH=../../storage/spec/
STORAGE_PATH=../../storage/spec/
4 changes: 2 additions & 2 deletions .github/workflows/plugin-fablab-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Plugin FABReader Build & Attach
name: Plugin FabReader Build & Attach

on:
# Run on pull requests
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `📦 FABReader plugin built and available as artifact: [${artifactName}.zip](${artifactUrl})`
body: `📦 FabReader plugin built and available as artifact: [${artifactName}.zip](${artifactUrl})`
});

# Attach to release
Expand Down
2 changes: 1 addition & 1 deletion apps/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"cache": true,
"outputs": ["{workspaceRoot}/dist/apps/{projectName}-swagger/swagger.json"],
"options": {
"command": "AUTH_SESSION_SECRET=super-secret VITE_ATTRACCESS_URL=http://localhost:3000 AUTH_JWT_ORIGIN=ENV AUTH_JWT_SECRET=swagger-export-dummy-jwt-secret123 SMTP_SERVICE=SMTP SMTP_HOST=not-a-host SMTP_PORT=1234 SMTP_FROM=mail@fabaccess.org FRONTEND_URL=http://localhost:4200 node dist/apps/api-swagger/main.js"
"command": "AUTH_SESSION_SECRET=super-secret VITE_FABACCESS_URL=http://localhost:3000 AUTH_JWT_ORIGIN=ENV AUTH_JWT_SECRET=swagger-export-dummy-jwt-secret123 SMTP_SERVICE=SMTP SMTP_HOST=not-a-host SMTP_PORT=1234 SMTP_FROM=mail@fabaccess.org FRONTEND_URL=http://localhost:4200 node dist/apps/api-swagger/main.js"
}
},
"test": {
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/config/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const AppEnvSchema = z
message: 'Invalid log level(s). Allowed: log, error, warn, debug, verbose.',
}),
AUTH_SESSION_SECRET: z.string().min(1, { message: 'AUTH_SESSION_SECRET is required' }),
VITE_ATTRACCESS_URL: z.string().url({ message: 'VITE_ATTRACCESS_URL must be a valid URL' }),
VITE_FABACCESS_URL: z.string().url({ message: 'VITE_FABACCESS_URL must be a valid URL' }),
FRONTEND_URL: z
.string()
.url({ message: 'FRONTEND_URL must be a valid URL' })
.default(process.env.VITE_ATTRACCESS_URL),
.default(process.env.VITE_FABACCESS_URL),
GLOBAL_PREFIX: z.string().default('api'),
VERSION: z.string().default(process.env.npm_package_version || '1.0.0'),
AUTH_JWT_SECRET: z.string(),
Expand Down
9 changes: 1 addition & 8 deletions apps/api/src/database/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { loadEnv } from '@fabaccess/env';
import { join, resolve } from 'path';
import { entities } from '@fabaccess/database-entities';
import * as migrations from './migrations';
import { existsSync } from 'fs';

const envType = loadEnv((z) => ({
DB_TYPE: z.enum(['postgres', 'sqlite']).default('sqlite'),
Expand Down Expand Up @@ -45,13 +44,7 @@ function loadPostgresConfig() {

function loadSqliteConfig() {
const storageEnv = loadEnv((z) => ({ STORAGE_ROOT: z.string().default(join(process.cwd(), 'storage')) }));
const fabaccessDbFile = resolve(join(storageEnv.STORAGE_ROOT, 'attraccess.sqlite'));
const attraccessDbFile = resolve(join(storageEnv.STORAGE_ROOT, 'attraccess.sqlite'));

let dbFile = fabaccessDbFile;
if (existsSync(attraccessDbFile)) {
dbFile = attraccessDbFile;
}
const dbFile = resolve(join(storageEnv.STORAGE_ROOT, 'fabaccess.sqlite'));

console.log('dbFile', dbFile);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const RESET_PASSWORD_MJML_TEMPLATE = `
<mj-text font-size="12px" color="#6B7280" align="center" padding="5px 0 0 0">
Visit us:
<a href="{{host.frontend}}">{{host.frontend}}</a> |
<a href="https://github.com/FabInfra/FabAccess">GitHub</a>
<a href="https://github.com/FabInfra/FabAccess-V2">GitHub</a>
</mj-text>
</mj-column>
</mj-section>
Expand Down Expand Up @@ -183,7 +183,7 @@ export const VERIFY_EMAIL_MJML_TEMPLATE = `
<mj-text font-size="12px" color="#6B7280" align="center" padding="5px 0 0 0">
Visit us:
<a href="{{host.frontend}}">{{host.frontend}}</a> |
<a href="https://github.com/FabInfra/FabAccess">GitHub</a>
<a href="https://github.com/FabInfra/FabAccess-V2">GitHub</a>
</mj-text>
</mj-column>
</mj-section>
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/email/email.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class EmailService {
const appConfig = this.configService.get<AppConfigType>('app');

this.frontendUrl = appConfig.FRONTEND_URL;
this.backendUrl = appConfig.VITE_ATTRACCESS_URL;
this.backendUrl = appConfig.VITE_FABACCESS_URL;

this.logger.debug(`EmailService initialized with FRONTEND_URL: ${this.frontendUrl}`);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/main.bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function bootstrap() {
if (appConfig.SSL_GENERATE_SELF_SIGNED_CERTIFICATES) {
const storageDir = storageConfig.root;

const host = appConfig.VITE_ATTRACCESS_URL;
const host = appConfig.VITE_FABACCESS_URL;
const hostUrl = new URL(host);
const domain = hostUrl.hostname;

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/users-and-auth/auth/sso/oidc/oidc.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class SSOOIDCGuard implements CanActivate {

const redirectTo = requestURL.searchParams.get('redirectTo');

const callbackURL = new URL(appConfig.VITE_ATTRACCESS_URL);
const callbackURL = new URL(appConfig.VITE_FABACCESS_URL);
callbackURL.pathname = `/api/auth/sso/${ssoType}/${providerId}/callback`;
callbackURL.searchParams.set('redirectTo', redirectTo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class SSOOIDCStrategy extends PassportStrategy(Strategy, 'sso-oidc') {
clientID: config.clientId,
clientSecret: config.clientSecret,
callbackURL,
scope: ['openid', 'email', 'profile'],
});

this.logger.log(`Initialized OIDC strategy with issuer: ${config.issuer} and callbackURL: ${callbackURL}`);
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function getInferredApiUrl() {
}

export function getBaseUrl() {
return import.meta.env.VITE_ATTRACCESS_URL || getInferredApiUrl();
return import.meta.env.VITE_FABACCESS_URL || getInferredApiUrl();
}

const setupApiParameters = () => {
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/src/app/layout/sidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const useSidebarEndItems = () => {

const reportBugUrl = newGithubIssueUrl({
user: 'FabInfra',
repo: 'FabAccess',
repo: 'FabAccess-V2',
title: '[Bug] ',
labels: ['bug'],
body: `
Expand All @@ -129,7 +129,7 @@ export const useSidebarEndItems = () => {

const requestFeatureUrl = newGithubIssueUrl({
user: 'FabInfra',
repo: 'FabAccess',
repo: 'FabAccess-V2',
title: '[Feature Request] ',
labels: ['enhancement'],
body: `
Expand Down Expand Up @@ -167,7 +167,7 @@ export const useSidebarEndItems = () => {
translationKey: 'dependencies',
},
{
path: getBaseUrl() + '/docs',
path: getBaseUrl() + '/docs/#/',
icon: BookOpenIcon,
translationKey: 'docs',
isExternal: true,
Expand Down
2 changes: 1 addition & 1 deletion docs/HOME.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FabAccess is a powerful platform designed to simplify and secure access manageme

## Support

Need help? Open an issue on our [GitHub repository](https://github.com/FabInfra/FabAccess).
Need help? Open an issue on our [GitHub repository](https://github.com/FabInfra/FabAccess-V2).

> [!NOTE]
> This documentation is also accessible directly from your running FabAccess instance at `<your-fabaccess-url>/docs`.
2 changes: 1 addition & 1 deletion docs/developer/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ FabAccess follows an Nx monorepo structure, organized into apps and libs:

4. Run database migrations:
```bash
nx run api:run-migrations
nx migrations-run api
```

### Development
Expand Down
10 changes: 5 additions & 5 deletions docs/setup/beginner-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Now, open the `.env` file with a text editor and add the following configuration
AUTH_JWT_ORIGIN=ENV
AUTH_JWT_SECRET=replace_with_a_long_random_string
AUTH_SESSION_SECRET=replace_with_another_long_random_string
VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000

# Email Configuration
SMTP_SERVICE=SMTP
Expand Down Expand Up @@ -121,16 +121,16 @@ If you've installed FabAccess on a remote server (not your local computer):
3. Go to `http://your-server-ip:3000` (replace `your-server-ip` with your actual server's IP address)
4. If you have a domain name pointing to your server, you can use `http://your-domain.com:3000`

> 💡 **Important:** When installing on a remote server, you should update the `VITE_ATTRACCESS_URL` in your `.env` file to match how you'll access the application:
> 💡 **Important:** When installing on a remote server, you should update the `VITE_FABACCESS_URL` in your `.env` file to match how you'll access the application:
>
> ```
> VITE_ATTRACCESS_URL=http://your-server-ip:3000
> VITE_FABACCESS_URL=http://your-server-ip:3000
> ```
>
> or
>
> ```
> VITE_ATTRACCESS_URL=http://your-domain.com:3000
> VITE_FABACCESS_URL=http://your-domain.com:3000
> ```

##### Firewall Considerations
Expand All @@ -146,7 +146,7 @@ For production environments, it's recommended to:

1. Set up a reverse proxy (like Nginx or Apache) in front of FabAccess
2. Configure SSL/TLS certificates (using Let's Encrypt)
3. Update your `VITE_ATTRACCESS_URL` to use `https://` instead of `http://`
3. Update your `VITE_FABACCESS_URL` to use `https://` instead of `http://`

Detailed instructions for setting up a secure proxy are beyond the scope of this beginner guide, but we recommend researching this for any production deployment.

Expand Down
10 changes: 5 additions & 5 deletions docs/setup/docker-compose-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
- AUTH_JWT_ORIGIN=ENV
- AUTH_JWT_SECRET=replace_with_a_long_random_string
- AUTH_SESSION_SECRET=replace_with_another_long_random_string
- VITE_ATTRACCESS_URL=http://localhost:3000
- VITE_FABACCESS_URL=http://localhost:3000

# Email Configuration
- SMTP_SERVICE=SMTP
Expand Down Expand Up @@ -129,16 +129,16 @@ Update the email settings in your `docker-compose.yml` file with your actual SMT

#### URL Configuration

If you're deploying FabAccess to be accessible from other computers, update the `VITE_ATTRACCESS_URL` with your actual domain or IP address:
If you're deploying FabAccess to be accessible from other computers, update the `VITE_FABACCESS_URL` with your actual domain or IP address:

```yaml
- VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com
- VITE_FABACCESS_URL=https://fabaccess.yourdomain.com
```

or

```yaml
- VITE_ATTRACCESS_URL=http://your-server-ip:3000
- VITE_FABACCESS_URL=http://your-server-ip:3000
```

### Step 5: Start FabAccess
Expand Down Expand Up @@ -231,7 +231,7 @@ touch .env
AUTH_JWT_ORIGIN=ENV
AUTH_JWT_SECRET=your_secure_jwt_secret
AUTH_SESSION_SECRET=your_secure_session_secret
VITE_ATTRACCESS_URL=http://localhost:3000
VITE_FABACCESS_URL=http://localhost:3000

# Email Configuration
SMTP_SERVICE=SMTP
Expand Down
8 changes: 4 additions & 4 deletions docs/setup/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ FabAccess requires several environment variables to function properly:
| `AUTH_JWT_ORIGIN` | JWT secret source, either "ENV" or "FILE" | Yes | - |
| `AUTH_JWT_SECRET` | JWT secret when using ENV origin | If AUTH_JWT_ORIGIN=ENV | - |
| `AUTH_SESSION_SECRET` | Secret for encrypting sessions | Yes | - |
| `VITE_ATTRACCESS_URL` | URL/hostname of your FabAccess instance | Yes | - |
| `VITE_FABACCESS_URL` | URL/hostname of your FabAccess instance | Yes | - |

> [!WARNING]
> Always use strong, unique secrets for `AUTH_JWT_SECRET` and `AUTH_SESSION_SECRET`. These are critical for your application's security.
Expand Down Expand Up @@ -86,7 +86,7 @@ docker run -d \
-e AUTH_JWT_ORIGIN=ENV \
-e AUTH_JWT_SECRET=your_secure_jwt_secret \
-e AUTH_SESSION_SECRET=your_secure_session_secret \
-e VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com \
-e VITE_FABACCESS_URL=https://fabaccess.yourdomain.com \
-e SMTP_SERVICE=SMTP \
-e SMTP_FROM=no-reply@yourdomain.com \
-e SMTP_HOST=smtp.yourdomain.com \
Expand Down Expand Up @@ -138,7 +138,7 @@ docker run -d \
-p 3000:3000 \
-e AUTH_JWT_ORIGIN=FILE \
-e AUTH_SESSION_SECRET=your_secure_session_secret \
-e VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com \
-e VITE_FABACCESS_URL=https://fabaccess.yourdomain.com \
-v /path/to/jwt/secret:/app/secrets \
-v /path/to/storage:/app/storage \
fabaccess/fabaccess:latest
Expand Down Expand Up @@ -171,7 +171,7 @@ docker run -d \
-e AUTH_JWT_ORIGIN=ENV \
-e AUTH_JWT_SECRET=your_secure_jwt_secret \
-e AUTH_SESSION_SECRET=your_secure_session_secret \
-e VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com \
-e VITE_FABACCESS_URL=https://fabaccess.yourdomain.com \
-v /path/to/plugins:/app/plugins \
-v /path/to/storage:/app/storage \
fabaccess/fabaccess:latest
Expand Down
4 changes: 2 additions & 2 deletions docs/setup/portainer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /va
| AUTH_JWT_ORIGIN | ENV |
| AUTH_JWT_SECRET | replace_with_a_long_random_string |
| AUTH_SESSION_SECRET | replace_with_another_long_random_string |
| VITE_ATTRACCESS_URL | http://your-server-ip:3000 |
| VITE_FABACCESS_URL | http://your-server-ip:3000 |
| SMTP_SERVICE | SMTP |
| SMTP_FROM | your-email@example.com |
| SMTP_HOST | smtp.example.com |
Expand Down Expand Up @@ -120,7 +120,7 @@ services:
- AUTH_JWT_ORIGIN=ENV
- AUTH_JWT_SECRET=replace_with_a_long_random_string
- AUTH_SESSION_SECRET=replace_with_another_long_random_string
- VITE_ATTRACCESS_URL=http://your-server-ip:3000
- VITE_FABACCESS_URL=http://your-server-ip:3000

# Email Configuration
- SMTP_SERVICE=SMTP
Expand Down
8 changes: 4 additions & 4 deletions docs/setup/ssl-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ docker run -d \
-e AUTH_JWT_ORIGIN=ENV \
-e AUTH_JWT_SECRET=your_secure_jwt_secret \
-e AUTH_SESSION_SECRET=your_secure_session_secret \
-e VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com \
-e VITE_FABACCESS_URL=https://fabaccess.yourdomain.com \
-v /path/to/storage:/app/storage \
fabaccess/fabaccess:latest
```
Expand Down Expand Up @@ -72,7 +72,7 @@ docker run -d \
-e AUTH_JWT_ORIGIN=ENV \
-e AUTH_JWT_SECRET=your_secure_jwt_secret \
-e AUTH_SESSION_SECRET=your_secure_session_secret \
-e VITE_ATTRACCESS_URL=https://fabaccess.yourdomain.com \
-e VITE_FABACCESS_URL=https://fabaccess.yourdomain.com \
-v /path/to/storage:/app/storage \
fabaccess/fabaccess:latest
```
Expand Down Expand Up @@ -165,7 +165,7 @@ Since self-signed certificates are not issued by a trusted Certificate Authority
1. **Use Custom Certificates for Production**: Always use proper CA-signed certificates for production environments
2. **Regular Renewal**: Monitor certificate expiration dates and renew before expiry
3. **Secure Storage**: Keep private keys secure and limit access to certificate files
4. **Strong Domains**: Use proper domain names in your `VITE_ATTRACCESS_URL` configuration
4. **Strong Domains**: Use proper domain names in your `VITE_FABACCESS_URL` configuration

## 🔧 Troubleshooting

Expand Down Expand Up @@ -199,7 +199,7 @@ For custom certificates:

When using SSL, make sure to:

- Use HTTPS URLs in your `VITE_ATTRACCESS_URL`
- Use HTTPS URLs in your `VITE_FABACCESS_URL`
- Map port 443 (standard HTTPS port) to container port 3000: `-p 443:3000`
- Update any firewall rules to allow HTTPS traffic on port 443

Expand Down
Loading
Loading