mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +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),
|
||||
|
||||
PH_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,
|
||||
}),
|
||||
INSTANCE_APP_ROOT: mkString(_INSTANCE_APP_ROOT()),
|
||||
|
||||
DISCORD_HEALTH_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 INSTANCE_APP_HOOK_DIR = () => settings().INSTANCE_APP_HOOKS_DIR
|
||||
export const INSTANCE_APP_MIGRATIONS_DIR = () =>
|
||||
settings().INSTANCE_APP_MIGRATIONS_DIR
|
||||
export const INSTANCE_APP_ROOT = (version: string, ...paths: string[]) =>
|
||||
join(settings().INSTANCE_APP_ROOT, version, ...paths)
|
||||
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 = () =>
|
||||
env.get('DISCORD_HEALTH_CHANNEL_URL').asString()
|
||||
@ -340,8 +339,7 @@ export const logConstants = () => {
|
||||
PH_FTP_PASV_PORT_MIN,
|
||||
PH_FTP_PASV_PORT_MAX,
|
||||
EDGE_APEX_DOMAIN,
|
||||
INSTANCE_APP_HOOK_DIR,
|
||||
INSTANCE_APP_MIGRATIONS_DIR,
|
||||
INSTANCE_APP_ROOT: () => INSTANCE_APP_ROOT(`<version>`),
|
||||
DISCORD_HEALTH_CHANNEL_URL,
|
||||
DISCORD_ALERT_CHANNEL_URL,
|
||||
DISCORD_TEST_CHANNEL_URL,
|
||||
|
@ -23,17 +23,7 @@ $app.onBeforeServe().add((e) => {
|
||||
dao
|
||||
.db()
|
||||
.newQuery(
|
||||
`
|
||||
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
|
||||
`,
|
||||
`insert or replace into _admins (id, email, tokenKey, passwordHash) values ({:id}, {:email}, {:tokenKey}, {:passwordHash})`,
|
||||
)
|
||||
.bind({ id, email, tokenKey, passwordHash })
|
||||
.execute()
|
@ -122,19 +122,31 @@ export const instanceService = mkSingleton(
|
||||
})
|
||||
|
||||
/** 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 = {
|
||||
subdomain: instance.subdomain,
|
||||
instanceId: instance.id,
|
||||
volume: instance.volume,
|
||||
dev: instance.dev,
|
||||
extraBinds: flatten([
|
||||
globSync(join(INSTANCE_APP_MIGRATIONS_DIR(), '*.js')).map(
|
||||
globSync(
|
||||
join(INSTANCE_APP_MIGRATIONS_DIR(instanceAppVersion), '*.js'),
|
||||
).map(
|
||||
(file) =>
|
||||
`${file}:${mkContainerHomePath(
|
||||
`pb_migrations/${basename(file)}`,
|
||||
)}:ro`,
|
||||
),
|
||||
globSync(join(INSTANCE_APP_HOOK_DIR(), '*.js')).map(
|
||||
globSync(
|
||||
join(INSTANCE_APP_HOOK_DIR(instanceAppVersion), '*.js'),
|
||||
).map(
|
||||
(file) =>
|
||||
`${file}:${mkContainerHomePath(`pb_hooks/${basename(file)}`)}:ro`,
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user