mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-23 22:15:49 +00:00
v23 prep
This commit is contained in:
parent
ba7ed7976d
commit
e8c459bed4
@ -121,13 +121,7 @@ export const createSettings = () => ({
|
|||||||
|
|
||||||
EDGE_APEX_DOMAIN: mkString(_APEX_DOMAIN),
|
EDGE_APEX_DOMAIN: mkString(_APEX_DOMAIN),
|
||||||
|
|
||||||
PH_INSTANCE_APP_ROOT: mkString(_INSTANCE_APP_ROOT()),
|
INSTANCE_APP_ROOT: mkString(_INSTANCE_APP_ROOT()),
|
||||||
INSTANCE_APP_HOOKS_DIR: mkPath(_INSTANCE_APP_ROOT(`pb_hooks`), {
|
|
||||||
create: true,
|
|
||||||
}),
|
|
||||||
INSTANCE_APP_MIGRATIONS_DIR: mkPath(_INSTANCE_APP_ROOT(`migrations`), {
|
|
||||||
create: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
DISCORD_HEALTH_CHANNEL_URL: mkString(''),
|
DISCORD_HEALTH_CHANNEL_URL: mkString(''),
|
||||||
DISCORD_ALERT_CHANNEL_URL: mkString(''),
|
DISCORD_ALERT_CHANNEL_URL: mkString(''),
|
||||||
@ -239,9 +233,14 @@ export const PH_FTP_PASV_PORT_MAX = () => settings().PH_FTP_PASV_PORT_MAX
|
|||||||
|
|
||||||
export const EDGE_APEX_DOMAIN = () => settings().EDGE_APEX_DOMAIN
|
export const EDGE_APEX_DOMAIN = () => settings().EDGE_APEX_DOMAIN
|
||||||
|
|
||||||
export const INSTANCE_APP_HOOK_DIR = () => settings().INSTANCE_APP_HOOKS_DIR
|
export const INSTANCE_APP_ROOT = (version: string, ...paths: string[]) =>
|
||||||
export const INSTANCE_APP_MIGRATIONS_DIR = () =>
|
join(settings().INSTANCE_APP_ROOT, version, ...paths)
|
||||||
settings().INSTANCE_APP_MIGRATIONS_DIR
|
export const INSTANCE_APP_HOOK_DIR = (version: string, ...paths: string[]) =>
|
||||||
|
INSTANCE_APP_ROOT(version, `pb_hooks`, ...paths)
|
||||||
|
export const INSTANCE_APP_MIGRATIONS_DIR = (
|
||||||
|
version: string,
|
||||||
|
...paths: string[]
|
||||||
|
) => INSTANCE_APP_ROOT(version, `pb_migrations`, ...paths)
|
||||||
|
|
||||||
export const DISCORD_HEALTH_CHANNEL_URL = () =>
|
export const DISCORD_HEALTH_CHANNEL_URL = () =>
|
||||||
env.get('DISCORD_HEALTH_CHANNEL_URL').asString()
|
env.get('DISCORD_HEALTH_CHANNEL_URL').asString()
|
||||||
@ -340,8 +339,7 @@ export const logConstants = () => {
|
|||||||
PH_FTP_PASV_PORT_MIN,
|
PH_FTP_PASV_PORT_MIN,
|
||||||
PH_FTP_PASV_PORT_MAX,
|
PH_FTP_PASV_PORT_MAX,
|
||||||
EDGE_APEX_DOMAIN,
|
EDGE_APEX_DOMAIN,
|
||||||
INSTANCE_APP_HOOK_DIR,
|
INSTANCE_APP_ROOT: () => INSTANCE_APP_ROOT(`<version>`),
|
||||||
INSTANCE_APP_MIGRATIONS_DIR,
|
|
||||||
DISCORD_HEALTH_CHANNEL_URL,
|
DISCORD_HEALTH_CHANNEL_URL,
|
||||||
DISCORD_ALERT_CHANNEL_URL,
|
DISCORD_ALERT_CHANNEL_URL,
|
||||||
DISCORD_TEST_CHANNEL_URL,
|
DISCORD_TEST_CHANNEL_URL,
|
||||||
|
|||||||
@ -23,17 +23,7 @@ $app.onBeforeServe().add((e) => {
|
|||||||
dao
|
dao
|
||||||
.db()
|
.db()
|
||||||
.newQuery(
|
.newQuery(
|
||||||
`
|
`insert or replace into _admins (id, email, tokenKey, passwordHash) values ({:id}, {:email}, {:tokenKey}, {:passwordHash})`,
|
||||||
insert into _admins (id, email, tokenKey, passwordHash) values ({:id}, {:email}, {:tokenKey}, {:passwordHash})
|
|
||||||
ON CONFLICT(email) DO UPDATE SET
|
|
||||||
id=excluded.id,
|
|
||||||
tokenKey=excluded.tokenKey,
|
|
||||||
passwordHash=excluded.passwordHash
|
|
||||||
ON CONFLICT(id) DO UPDATE SET
|
|
||||||
email=excluded.email,
|
|
||||||
tokenKey=excluded.tokenKey,
|
|
||||||
passwordHash=excluded.passwordHash
|
|
||||||
`,
|
|
||||||
)
|
)
|
||||||
.bind({ id, email, tokenKey, passwordHash })
|
.bind({ id, email, tokenKey, passwordHash })
|
||||||
.execute()
|
.execute()
|
||||||
@ -122,19 +122,31 @@ export const instanceService = mkSingleton(
|
|||||||
})
|
})
|
||||||
|
|
||||||
/** Create spawn config */
|
/** Create spawn config */
|
||||||
|
const instanceAppVersion = (() => {
|
||||||
|
const [major, minor] = instance.version.split('.').map(Number)
|
||||||
|
if (!minor) {
|
||||||
|
throw new Error(`Invalid version: ${instance.version}`)
|
||||||
|
}
|
||||||
|
if (minor <= 22) return `v22`
|
||||||
|
return `v23`
|
||||||
|
})()
|
||||||
const spawnArgs: SpawnConfig = {
|
const spawnArgs: SpawnConfig = {
|
||||||
subdomain: instance.subdomain,
|
subdomain: instance.subdomain,
|
||||||
instanceId: instance.id,
|
instanceId: instance.id,
|
||||||
volume: instance.volume,
|
volume: instance.volume,
|
||||||
dev: instance.dev,
|
dev: instance.dev,
|
||||||
extraBinds: flatten([
|
extraBinds: flatten([
|
||||||
globSync(join(INSTANCE_APP_MIGRATIONS_DIR(), '*.js')).map(
|
globSync(
|
||||||
|
join(INSTANCE_APP_MIGRATIONS_DIR(instanceAppVersion), '*.js'),
|
||||||
|
).map(
|
||||||
(file) =>
|
(file) =>
|
||||||
`${file}:${mkContainerHomePath(
|
`${file}:${mkContainerHomePath(
|
||||||
`pb_migrations/${basename(file)}`,
|
`pb_migrations/${basename(file)}`,
|
||||||
)}:ro`,
|
)}:ro`,
|
||||||
),
|
),
|
||||||
globSync(join(INSTANCE_APP_HOOK_DIR(), '*.js')).map(
|
globSync(
|
||||||
|
join(INSTANCE_APP_HOOK_DIR(instanceAppVersion), '*.js'),
|
||||||
|
).map(
|
||||||
(file) =>
|
(file) =>
|
||||||
`${file}:${mkContainerHomePath(`pb_hooks/${basename(file)}`)}:ro`,
|
`${file}:${mkContainerHomePath(`pb_hooks/${basename(file)}`)}:ro`,
|
||||||
),
|
),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user