Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit e9cbbf0

Browse files
committed
Tweak separate database handling
1 parent f2281f9 commit e9cbbf0

File tree

6 files changed

+37
-25
lines changed

6 files changed

+37
-25
lines changed

.env.example

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ APP_TIMEZONE=Europe/Berlin
88

99
# Database for SQLgreyGUI
1010
# If you want to use a single database for both SQLgreyGUI and SQLgrey use only this config block
11-
DB_CONNECTION=mysql
11+
DB_CONNECTION=sqlgreygui
12+
DB_DRIVER=mysql
1213
DB_HOST=127.0.0.1
1314
DB_PORT=3306
1415
DB_DATABASE=sqlgrey
1516
DB_USERNAME=sqlgrey
1617
DB_PASSWORD=sqlgrey
1718

1819
# Uncomment the following lines if SQLgrey resides in a different database
19-
#SQLGREY_DB_CONNECTION=mysql
20+
#SQLGREY_DB_CONNECTION=sqlgrey
21+
SQLGREY_DB_DRIVER=mysql
2022
#SQLGREY_DB_HOST=null
2123
#SQLGREY_DB_PORT=3306
2224
#SQLGREY_DB_DATABASE=null

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel
1414

1515
## Documentation
1616
Visit the [official homepage](https://lbausch.github.io/SQLgreyGUI/) for requirements, installation instructions and further information.
17-

ci/.env.testing

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
APP_NAME=SQLgreyGUI
12
APP_ENV=testing
23
APP_KEY=
34
APP_DEBUG=true
@@ -6,21 +7,23 @@ APP_URL=http://localhost
67
APP_TIMEZONE=Europe/Berlin
78

89
# Database for SQLgreyGUI
9-
# if you want to use a single database for both SQLgreyGUI and SQLgrey use only this config block
10-
DB_CONNECTION=mysql
10+
# If you want to use a single database for both SQLgreyGUI and SQLgrey use only this config block
11+
DB_CONNECTION=sqlgreygui
12+
DB_DRIVER=mysql
1113
DB_HOST=127.0.0.1
1214
DB_PORT=3306
1315
DB_DATABASE=testing
1416
DB_USERNAME=homestead
1517
DB_PASSWORD=secret
1618

1719
# Uncomment the following lines if SQLgrey resides in a different database
18-
#SQLGREY_DB_CONNECTION=mysql
19-
#SQLGREY_DB_HOST=null
20+
#SQLGREY_DB_CONNECTION=sqlgrey
21+
#SQLGREY_DB_DRIVER=mysql
22+
#SQLGREY_DB_HOST=
2023
#SQLGREY_DB_PORT=3306
21-
#SQLGREY_DB_DATABASE=null
22-
#SQLGREY_DB_USERNAME=null
23-
#SQLGREY_DB_PASSWORD=null
24+
#SQLGREY_DB_DATABASE=
25+
#SQLGREY_DB_USERNAME=
26+
#SQLGREY_DB_PASSWORD=
2427

2528
BROADCAST_DRIVER=log
2629
CACHE_DRIVER=file
@@ -32,7 +35,7 @@ REDIS_PASSWORD=null
3235
REDIS_PORT=6379
3336

3437
MAIL_DRIVER=log
35-
MAIL_HOST=mailtrap.io
38+
MAIL_HOST=smtp.mailtrap.io
3639
MAIL_PORT=2525
3740
MAIL_USERNAME=null
3841
MAIL_PASSWORD=null

config/database.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
|
1414
*/
1515

16-
'default' => env('DB_CONNECTION', 'mysql'),
16+
'default' => env('DB_CONNECTION', 'sqlgreygui'),
1717

1818
/*
1919
|--------------------------------------------------------------------------
@@ -33,14 +33,8 @@
3333

3434
'connections' => [
3535

36-
'sqlite' => [
37-
'driver' => 'sqlite',
38-
'database' => env('DB_DATABASE', database_path('database.sqlite')),
39-
'prefix' => '',
40-
],
41-
42-
'mysql' => [
43-
'driver' => 'mysql',
36+
'sqlgreygui' => [
37+
'driver' => env('DB_DRIVER', 'mysql'),
4438
'host' => env('DB_HOST', '127.0.0.1'),
4539
'port' => env('DB_PORT', '3306'),
4640
'database' => env('DB_DATABASE', 'forge'),
@@ -49,13 +43,14 @@
4943
'unix_socket' => env('DB_SOCKET', ''),
5044
'charset' => 'utf8mb4',
5145
'collation' => 'utf8mb4_unicode_ci',
46+
'prefix' => env('DB_PREFIX', 'sg_'),
5247
'strict' => true,
5348
'engine' => null,
54-
'prefix' => env('DB_PREFIX', 'sg_'),
5549
],
5650

57-
'mysql_sqlgrey' => [
58-
'driver' => 'mysql',
51+
52+
'sqlgrey' => [
53+
'driver' => env('SQLGREY_DB_DRIVER', env('DB_DRIVER', 'mysql')),
5954
'host' => env('SQLGREY_DB_HOST', env('DB_HOST')),
6055
'port' => env('SQLGREY_DB_PORT', env('DB_PORT')),
6156
'database' => env('SQLGREY_DB_DATABASE', env('DB_DATABASE')),
@@ -82,6 +77,12 @@
8277
'sslmode' => 'prefer',
8378
],
8479

80+
'sqlite' => [
81+
'driver' => 'sqlite',
82+
'database' => env('DB_DATABASE', database_path('database.sqlite')),
83+
'prefix' => '',
84+
],
85+
8586
'sqlsrv' => [
8687
'driver' => 'sqlsrv',
8788
'host' => env('DB_HOST', 'localhost'),

config/sqlgreygui.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

33
return [
4-
'connection' => env('DB_CONNECTION_SQLGREY', 'mysql_sqlgrey'),
4+
'connection' => env('SQLGREY_DB_CONNECTION', 'sqlgrey'),
55
];

docs/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Whitelist: Add sender emails or sender domains to prevent them from being greylisted and delivered directly
55
* Opt-Out: Define emails or domains you don't want greylisting to be enabled for
66
* Opt-In: Define emails or domains for which you want to enforce greylisting permanently
7-
* Option of using seperate databases for SQLgrey and the application itself. This way you can maintain a user database in a single place and use it with all installations of SQLgreyGUI. In addition you don't need to alter the SQLgrey database at all.
7+
* Option of using separate databases for SQLgrey and the application itself. This way you can maintain a user database in a single place and use it with all installations of SQLgreyGUI. In addition you don't need to alter the SQLgrey database at all.
88

99

1010
## Requirements
@@ -26,4 +26,11 @@
2626
* Add cron entry `* * * * * php /path/to/sqlgreygui/artisan schedule:run >> /dev/null 2>&1` which will delete _undef_ records from the database
2727

2828

29+
## Using separate databases for SQLgrey and SQLgreyGUI
30+
Adjust the values starting with `SQLGREY_DB_` in the `.env` file.
31+
Refer to the `.env.example` file for possible entries.
32+
The default configuration in `config/database.php` is designed to work with MySQL out of the box.
33+
If you need different settings, e.g. for PostgreSQL, take a look at the existing config blocks in `config/database.php`.
34+
Additional documentation for available configuration possibilities may be found in the [Laravel documentation](https://laravel.com/docs/5.4/database#configuration).
35+
2936
Follow [@SQLgreyGUI](https://twitter.com/sqlgreygui) on Twitter

0 commit comments

Comments
 (0)