mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-08-01 03:34:44 +02:00
Add optional useSSL config option
This commit is contained in:
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2015
|
Copyright (c) 2015-17
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@@ -23,7 +23,7 @@ public class AuthStorage {
|
|||||||
private final HikariDataSource dataSource;
|
private final HikariDataSource dataSource;
|
||||||
|
|
||||||
public AuthStorage(FastLoginCore<?, ?, ?> core, String driver, String host, int port, String databasePath
|
public AuthStorage(FastLoginCore<?, ?, ?> core, String driver, String host, int port, String databasePath
|
||||||
, String user, String pass) {
|
, String user, String pass, boolean useSSL) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
|
|
||||||
HikariConfig databaseConfig = new HikariConfig();
|
HikariConfig databaseConfig = new HikariConfig();
|
||||||
@@ -34,6 +34,7 @@ public class AuthStorage {
|
|||||||
//a try to fix https://www.spigotmc.org/threads/fastlogin.101192/page-26#post-1874647
|
//a try to fix https://www.spigotmc.org/threads/fastlogin.101192/page-26#post-1874647
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss");
|
properties.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss");
|
||||||
|
properties.setProperty("useSSL", String.valueOf(useSSL));
|
||||||
databaseConfig.setDataSourceProperties(properties);
|
databaseConfig.setDataSourceProperties(properties);
|
||||||
|
|
||||||
ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder()
|
ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder()
|
||||||
|
@@ -162,7 +162,9 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
|
|||||||
String user = sharedConfig.get("username", "");
|
String user = sharedConfig.get("username", "");
|
||||||
String password = sharedConfig.get("password", "");
|
String password = sharedConfig.get("password", "");
|
||||||
|
|
||||||
storage = new AuthStorage(this, driver, host, port, database, user, password);
|
boolean useSSL = sharedConfig.get("useSSL", false);
|
||||||
|
|
||||||
|
storage = new AuthStorage(this, driver, host, port, database, user, password, useSSL);
|
||||||
try {
|
try {
|
||||||
storage.createTables();
|
storage.createTables();
|
||||||
return true;
|
return true;
|
||||||
|
@@ -164,10 +164,14 @@ driver: org.sqlite.JDBC
|
|||||||
# File location
|
# File location
|
||||||
database: '{pluginDir}/FastLogin.db'
|
database: '{pluginDir}/FastLogin.db'
|
||||||
|
|
||||||
# MySQL
|
# MySQL/MariaDB
|
||||||
#driver: com.mysql.jdbc.Driver
|
#driver: com.mysql.jdbc.Driver
|
||||||
#host: localhost
|
#host: localhost
|
||||||
#port: 3306
|
#port: 3306
|
||||||
#database: fastlogin
|
#database: fastlogin
|
||||||
#username: myUser
|
#username: myUser
|
||||||
#password: myPassword
|
#password: myPassword
|
||||||
|
|
||||||
|
# It's strongly recommended to enable SSL and setup a SSL certificate if the MySQL server isn't running on the same
|
||||||
|
# machine
|
||||||
|
#useSSL: false
|
||||||
|
Reference in New Issue
Block a user