#374 - private setting to change the HTTP host
This commit is contained in:
@@ -67,6 +67,8 @@ export interface OmnisearchSettings extends WeightingSettings {
|
|||||||
httpApiEnabled: boolean
|
httpApiEnabled: boolean
|
||||||
httpApiPort: string
|
httpApiPort: string
|
||||||
httpApiNotice: boolean
|
httpApiNotice: boolean
|
||||||
|
|
||||||
|
DANGER_httpHost: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -751,6 +753,8 @@ export function getDefaultSettings(app: App): OmnisearchSettings {
|
|||||||
|
|
||||||
welcomeMessage: '',
|
welcomeMessage: '',
|
||||||
verboseLogging: false,
|
verboseLogging: false,
|
||||||
|
|
||||||
|
DANGER_httpHost: null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,14 @@ export function getServer(plugin: OmnisearchPlugin) {
|
|||||||
server.listen(
|
server.listen(
|
||||||
{
|
{
|
||||||
port: parseInt(port),
|
port: parseInt(port),
|
||||||
host: 'localhost',
|
host: plugin.settings.DANGER_httpHost ?? 'localhost',
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log(`Omnisearch - Started HTTP server on port ${port}`)
|
console.log(`Omnisearch - Started HTTP server on port ${port}`)
|
||||||
if (plugin.settings.httpApiNotice) {
|
if (plugin.settings.DANGER_httpHost && plugin.settings.DANGER_httpHost !== 'localhost') {
|
||||||
|
new Notice(`Omnisearch - Started non-localhost HTTP server at ${plugin.settings.DANGER_httpHost}:${port}`, 120_000)
|
||||||
|
}
|
||||||
|
else if (plugin.settings.httpApiNotice) {
|
||||||
new Notice(`Omnisearch - Started HTTP server on port ${port}`)
|
new Notice(`Omnisearch - Started HTTP server on port ${port}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user