mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
setup: handle DATABASE_URL more transparently on re-runs
This commit is contained in:
parent
078c267bb8
commit
dbacb6b63a
1 changed files with 18 additions and 13 deletions
|
|
@ -41,20 +41,25 @@ if (DITTO_NSEC) {
|
||||||
const domain = await question('input', 'What is the domain of your instance? (eg ditto.pub)', Conf.url.host);
|
const domain = await question('input', 'What is the domain of your instance? (eg ditto.pub)', Conf.url.host);
|
||||||
vars.LOCAL_DOMAIN = `https://${domain}`;
|
vars.LOCAL_DOMAIN = `https://${domain}`;
|
||||||
|
|
||||||
|
const DATABASE_URL = Deno.env.get('DATABASE_URL');
|
||||||
|
|
||||||
|
if (DATABASE_URL) {
|
||||||
|
vars.DATABASE_URL = await question('input', 'Database URL', DATABASE_URL);
|
||||||
|
} else {
|
||||||
const database = await question('list', 'Which database do you want to use?', ['postgres', 'sqlite']);
|
const database = await question('list', 'Which database do you want to use?', ['postgres', 'sqlite']);
|
||||||
if (database === 'sqlite') {
|
if (database === 'sqlite') {
|
||||||
const path = await question('input', 'Path to SQLite database', 'data/db.sqlite3');
|
const path = await question('input', 'Path to SQLite database', 'data/db.sqlite3');
|
||||||
vars.DATABASE_URL = `sqlite://${path}`;
|
vars.DATABASE_URL = `sqlite://${path}`;
|
||||||
}
|
}
|
||||||
if (database === 'postgres') {
|
if (database === 'postgres') {
|
||||||
const url = nodeUrl.parse(Deno.env.get('DATABASE_URL') ?? 'postgres://ditto:ditto@localhost:5432/ditto');
|
const host = await question('input', 'Postgres host', 'localhost');
|
||||||
const host = await question('input', 'Postgres host', url.hostname);
|
const port = await question('input', 'Postgres port', '5432');
|
||||||
const port = await question('input', 'Postgres port', url.port);
|
const user = await question('input', 'Postgres user', 'ditto');
|
||||||
const user = await question('input', 'Postgres user', url.username);
|
const password = await question('input', 'Postgres password', 'ditto');
|
||||||
const password = await question('input', 'Postgres password', url.password);
|
const database = await question('input', 'Postgres database', 'ditto');
|
||||||
const database = await question('input', 'Postgres database', url.pathname.slice(1));
|
|
||||||
vars.DATABASE_URL = `postgres://${user}:${password}@${host}:${port}/${database}`;
|
vars.DATABASE_URL = `postgres://${user}:${password}@${host}:${port}/${database}`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vars.DITTO_UPLOADER = await question('list', 'How do you want to upload files?', [
|
vars.DITTO_UPLOADER = await question('list', 'How do you want to upload files?', [
|
||||||
'nostrbuild',
|
'nostrbuild',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue