mirror of
https://github.com/spacedeck/spacedeck-open.git
synced 2025-12-15 17:37:30 +01:00
20
README.md
20
README.md
@@ -64,6 +64,26 @@ For advanced media conversion:
|
||||
By default, media files are uploaded to the ```storage``` folder.
|
||||
The database is stored in ```database.sqlite``` by default.
|
||||
|
||||
# Other databases (Not officially supported)
|
||||
|
||||
## Postgres
|
||||
|
||||
Add the [pg](https://www.npmjs.com/package/pg) module and change the config/default.json to
|
||||
|
||||
```
|
||||
"storage_dialect": "postgres",
|
||||
```
|
||||
|
||||
Adapt the other values as needed
|
||||
|
||||
```
|
||||
"storage_host": "localhost",
|
||||
"storage_database": "spacedeck",
|
||||
"storage_username": "username",
|
||||
"storage_password": "password",
|
||||
```
|
||||
|
||||
|
||||
# Run with Docker
|
||||
|
||||
- configure `config/default.json`
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
"endpoint": "http://localhost:9666",
|
||||
"invite_code": "top-sekrit",
|
||||
|
||||
"storage_dialect": "sqlite",
|
||||
|
||||
"storage_host": "localhost",
|
||||
"storage_database": "spacedeck",
|
||||
"storage_username": "username",
|
||||
"storage_password": "password",
|
||||
|
||||
"storage_local_path": "./storage",
|
||||
"storage_local_db": "./database.sqlite",
|
||||
"storage_region": "eu-central-1",
|
||||
|
||||
40
models/db.js
40
models/db.js
@@ -6,24 +6,28 @@ function sequel_log(a,b,c) {
|
||||
}
|
||||
|
||||
const Sequelize = require('sequelize');
|
||||
const sequelize = new Sequelize('database', 'username', 'password', {
|
||||
host: 'localhost',
|
||||
dialect: 'sqlite',
|
||||
|
||||
pool: {
|
||||
max: 5,
|
||||
min: 0,
|
||||
acquire: 30000,
|
||||
idle: 10000
|
||||
},
|
||||
|
||||
// SQLite only
|
||||
storage: config.get('storage_local_db'),
|
||||
logging: sequel_log,
|
||||
|
||||
// http://docs.sequelizejs.com/manual/tutorial/querying.html#operators
|
||||
operatorsAliases: false
|
||||
});
|
||||
const sequelize = new Sequelize(
|
||||
config.get('storage_database'),
|
||||
config.get('storage_username'),
|
||||
config.get('storage_password'),
|
||||
{
|
||||
host: config.get('storage_host'),
|
||||
dialect: config.get('storage_dialect'),
|
||||
pool: {
|
||||
max: 5,
|
||||
min: 0,
|
||||
acquire: 30000,
|
||||
idle: 10000
|
||||
},
|
||||
logging: sequel_log,
|
||||
// http://docs.sequelizejs.com/manual/tutorial/querying.html#operators
|
||||
operatorsAliases: false,
|
||||
// SQLite only
|
||||
storage: config.get('storage_local_db')
|
||||
}
|
||||
);
|
||||
// https://github.com/sequelize/sequelize/issues/8019#issuecomment-384316346
|
||||
Sequelize.postgres.DECIMAL.parse = function (value) { return parseFloat(value); };
|
||||
|
||||
var User;
|
||||
var Session;
|
||||
|
||||
Reference in New Issue
Block a user