Update README #1

Merged
bloodwiing merged 6 commits from readme-update into main 2025-05-11 19:20:52 +00:00
2 changed files with 44 additions and 23 deletions
Showing only changes of commit 4d53448465 - Show all commits

View File

@ -2,9 +2,13 @@ import { env } from '$lib/env';
import postgres from 'postgres';
import ssh2 from 'ssh2';
// @ts-ignore
export const sql = postgres(
{
/**
* @returns {postgres.Options<{}>}
*/
function getPostreConfig() {
if (env.SSH_ENABLE == 'true') {
// with ssh
return {
host: env.PG_HOST,
port: parseInt(env.PG_PORT),
database: env.PG_DATABASE,
@ -28,4 +32,20 @@ export const sql = postgres(
})
})
}
} else {
// no ssh
return {
host: env.PG_HOST,
port: parseInt(env.PG_PORT),
database: env.PG_DATABASE,
username: env.PG_USERNAME,
password: env.PG_PASSWORD,
}
}
}
export const sql = postgres(
getPostreConfig()
);

View File

@ -5,6 +5,7 @@ export type Env = {
PG_PORT: string,
PG_DATABASE: string,
SSH_ENABLE: string,
SSH_HOST: string,
SSH_PORT: string,
SSH_USERNAME: string,