File tree Expand file tree Collapse file tree 5 files changed +16
-9
lines changed
Expand file tree Collapse file tree 5 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ cd proto && buf generate
191191
192192``` bash
193193# Start dev server
194- go run ./cmd/memos --mode dev -- port 8081
194+ go run ./cmd/memos --port 8081
195195
196196# Run all tests
197197go test ./...
@@ -458,7 +458,7 @@ cd web && pnpm lint
458458
459459| Variable | Default | Description |
460460| ----------| ----------| -------------|
461- | ` MEMOS_MODE ` | ` dev ` | Mode: ` dev ` , ` prod ` , ` demo ` |
461+ | ` MEMOS_DEMO ` | ` false ` | Enable demo mode |
462462| ` MEMOS_PORT ` | ` 8081 ` | HTTP port |
463463| ` MEMOS_ADDR ` | `` | Bind address (empty = all) |
464464| ` MEMOS_DATA ` | ` ~/.memos ` | Data directory |
@@ -564,7 +564,7 @@ Each plugin has its own README with usage examples.
564564
565565## Security Notes
566566
567- - JWT secrets must be kept secret (` MEMOS_MODE=prod ` generates random secret )
567+ - JWT secrets must be kept secret (generated on first run in production mode )
568568- Personal Access Tokens stored as SHA-256 hashes in database
569569- CSRF protection via SameSite cookies
570570- CORS enabled for all origins (configure for production)
Original file line number Diff line number Diff line change @@ -57,14 +57,22 @@ func (p *Profile) Validate() error {
5757 // Set default data directory if not specified
5858 if p .Data == "" {
5959 if p .Demo {
60- // In demo mode, use a temporary directory or current directory
60+ // In demo mode, use current directory
6161 p .Data = "."
6262 } else {
6363 // In production mode, use system directory
6464 if runtime .GOOS == "windows" {
6565 p .Data = filepath .Join (os .Getenv ("ProgramData" ), "memos" )
6666 } else {
67- p .Data = "/var/opt/memos"
67+ // On Linux/macOS, check if /var/opt/memos exists (Docker scenario)
68+ // If not, fall back to current directory to avoid permission issues
69+ if _ , err := os .Stat ("/var/opt/memos" ); err == nil {
70+ p .Data = "/var/opt/memos"
71+ } else {
72+ slog .Warn ("default production data directory /var/opt/memos not accessible, using current directory. " +
73+ "Consider using --data flag to specify a data directory." )
74+ p .Data = "."
75+ }
6876 }
6977 }
7078 }
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ USER nonroot:nonroot
4747VOLUME /var/opt/memos
4848
4949ENV TZ="UTC" \
50- MEMOS_MODE="prod" \
5150 MEMOS_PORT="5230"
5251
5352EXPOSE 5230
Original file line number Diff line number Diff line change @@ -29,4 +29,4 @@ go build -o "$OUTPUT" ./cmd/memos
2929
3030echo " Build successful!"
3131echo " To run the application, execute the following command:"
32- echo " $OUTPUT --mode dev "
32+ echo " $OUTPUT "
Original file line number Diff line number Diff line change @@ -174,10 +174,10 @@ To run with demo data:
174174
175175``` bash
176176# Start in demo mode
177- go run ./cmd/memos --mode demo --port 8081
177+ go run ./cmd/memos --demo --port 8081
178178
179179# Or use the binary
180- ./memos --mode demo
180+ ./memos --demo
181181
182182# Demo database location
183183./build/memos_demo.db
You can’t perform that action at this time.
0 commit comments