-
-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: create a separate section for network settings
- Loading branch information
1 parent
c619c45
commit c32a470
Showing
7 changed files
with
147 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
server/lib/settings/migrations/0005_migrate_network_settings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { AllSettings } from '@server/lib/settings'; | ||
|
||
const migrateNetworkSettings = (settings: any): AllSettings => { | ||
if (settings.network) { | ||
return settings; | ||
} | ||
const newSettings = { ...settings }; | ||
newSettings.network = { | ||
...settings.network, | ||
csrfProtection: settings.main.csrfProtection ?? false, | ||
trustProxy: settings.main.trustProxy ?? false, | ||
forceIpv4First: settings.main.forceIpv4First ?? false, | ||
dnsServers: settings.main.dnsServers ?? '', | ||
proxy: settings.main.proxy ?? { | ||
enabled: false, | ||
hostname: '', | ||
port: 8080, | ||
useSsl: false, | ||
user: '', | ||
password: '', | ||
bypassFilter: '', | ||
bypassLocalAddresses: true, | ||
}, | ||
}; | ||
delete settings.main.csrfProtection; | ||
delete settings.main.trustProxy; | ||
delete settings.main.forceIpv4First; | ||
delete settings.main.dnsServers; | ||
delete settings.main.proxy; | ||
return newSettings; | ||
}; | ||
|
||
export default migrateNetworkSettings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters