Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { startServer } from './server.js';
import { defaults } from './config.js';

const PORT = process.env.PORT || 3000;
const PORT = process.env.PORT || defaults.port;
const HOST = process.env.HOST || '0.0.0.0';

startServer(PORT, HOST).then(() => {
Expand Down
7 changes: 4 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { AccessMode } from './wac/parser.js';
import { registerNostrRelay } from './nostr/relay.js';
import { createPayHandler, isPayRequest } from './handlers/pay.js';
import { activityPubPlugin, getActorHandler } from './ap/index.js';
import { defaults } from './config.js';
import { remoteStoragePlugin } from './remotestorage.js';
import { dbPlugin } from './db/index.js';
import { mcpPlugin } from './mcp/index.js';
Expand Down Expand Up @@ -875,7 +876,7 @@ export function createServer(options = {}) {
// Determine base URL for pod URIs
const protocol = options.ssl ? 'https' : 'http';
const host = options.host === '0.0.0.0' ? 'localhost' : (options.host || 'localhost');
const port = options.port || 3000;
const port = options.port || defaults.port;
const baseUrl = idpIssuer?.replace(/\/$/, '') || `${protocol}://${host}:${port}`;
const issuer = idpIssuer || `${baseUrl}/`;

Expand Down Expand Up @@ -1220,7 +1221,7 @@ export function createServer(options = {}) {
const dataRoot = options.root || process.env.DATA_ROOT || './data';
const protocol = options.ssl ? 'https' : 'http';
// Use configured port, or default; actual URL will be localhost
const port = options.port || 3000;
const port = options.port || defaults.port;
const baseUrl = `${protocol}://localhost:${port}`;
startFileWatcher(dataRoot, baseUrl);
}
Expand All @@ -1231,7 +1232,7 @@ export function createServer(options = {}) {
/**
* Start the server
*/
export async function startServer(port = 3000, host = '0.0.0.0') {
export async function startServer(port = defaults.port, host = '0.0.0.0') {
const server = createServer();

try {
Expand Down