Skip to content
This repository was archived by the owner on Apr 23, 2024. It is now read-only.

Make some directories configrable #499

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion api/src/api/v1/Files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Endpoint } from '../base/Endpoint'
import { Auth, AuthMaybe } from '../middlewares/Auth'
import { Messages } from './Messages'

const CACHE_DIR = `${__dirname}/../../../../.cached`
const CACHE_DIR = process.env.CACHE_DIR || `${__dirname}/../../../../.cached`

@Endpoint.API()
export class Files {
Expand Down
6 changes: 4 additions & 2 deletions api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,14 @@ app.use(async (err: { status?: number, body?: Record<string, any> }, req: Reques
return res.status(err.status || 500).send(err.body || { error: 'Something error', details: serializeError(err) })
})

const WEB_SERVE_DIR = process.env.WEB_SERVE_DIR || path.join(__dirname, '..', '..', 'web', 'build')

// serve web
app.use(serveStatic(path.join(__dirname, '..', '..', 'web', 'build')))
app.use(serveStatic(`${WEB_SERVE_DIR}`))
app.use((req: Request, res: Response) => {
try {
if (req.headers['accept'] !== 'application/json') {
return res.sendFile(path.join(__dirname, '..', '..','web', 'build', 'index.html'))
return res.sendFile(path.join(`${WEB_SERVE_DIR}`, 'index.html'))
}
return res.status(404).send({ error: 'Not found' })
} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/Installation/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ variables in `./api/.env`, you can copy from `./api/.env.example`
| ---------------------- | -------- | ----------------------------------------------------- |
| ENV | no | Hide the logs for production, default: develop |
| PORT | no | Port for running API, default: 4000 |
| CACHE_DIR | no | Directory to cache saved files |
| WEB_SERVE_DIR | no | Directory to serve the static web build, only needed when you build web workspace separately in somewhere else |
| TG_API_ID | yes | Application ID from your Telegram App |
| TG_API_HASH | yes | Application hash from Telegram App |
| ADMIN_USERNAME | yes | Telegram username of the admin TeleDrive |
Expand Down