mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-22 10:36:03 +02:00
PgSQL updates in other components
This commit is contained in:
parent
ba05bd618c
commit
274760f2c5
7 changed files with 36 additions and 13 deletions
10
das/config.php
Normal file
10
das/config.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'db_type' => 'mysql',
|
||||||
|
'db_host' => 'localhost',
|
||||||
|
'db_port' => 3306,
|
||||||
|
'db_database' => 'your_database_name',
|
||||||
|
'db_username' => 'your_username',
|
||||||
|
'db_password' => 'your_password'
|
||||||
|
];
|
|
@ -34,7 +34,8 @@ $server->on('connect', function ($server, $fd) {
|
||||||
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
// Connect to the database
|
// Connect to the database
|
||||||
try {
|
try {
|
||||||
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
$c = require_once 'config.php';
|
||||||
|
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$server->send($fd, "Error connecting to database");
|
$server->send($fd, "Error connecting to database");
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
//require 'vendor/autoload.php';
|
//require 'vendor/autoload.php';
|
||||||
global $c;
|
global $c;
|
||||||
$c = require 'config.php';
|
$c = require_once 'config.php';
|
||||||
require_once 'EppWriter.php';
|
require_once 'EppWriter.php';
|
||||||
|
|
||||||
use Swoole\Coroutine\Server;
|
use Swoole\Coroutine\Server;
|
||||||
|
@ -14,8 +14,8 @@ $table->column('clid', Table::TYPE_STRING, 64);
|
||||||
$table->column('logged_in', Table::TYPE_INT, 1);
|
$table->column('logged_in', Table::TYPE_INT, 1);
|
||||||
$table->create();
|
$table->create();
|
||||||
|
|
||||||
$dsn = "mysql:host={$c['mysql_host']};dbname={$c['mysql_database']};port={$c['mysql_port']}";
|
$dsn = "{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']};port={$c['db_port']}";
|
||||||
$db = new PDO($dsn, $c['mysql_username'], $c['mysql_password']);
|
$db = new PDO($dsn, $c['db_username'], $c['db_password']);
|
||||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
Swoole\Runtime::enableCoroutine();
|
Swoole\Runtime::enableCoroutine();
|
||||||
|
|
10
rdap/config.php
Normal file
10
rdap/config.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'db_type' => 'mysql',
|
||||||
|
'db_host' => 'localhost',
|
||||||
|
'db_port' => 3306,
|
||||||
|
'db_database' => 'your_database_name',
|
||||||
|
'db_username' => 'your_username',
|
||||||
|
'db_password' => 'your_password'
|
||||||
|
];
|
|
@ -55,7 +55,8 @@ $http->set([
|
||||||
$http->on('request', function ($request, $response) {
|
$http->on('request', function ($request, $response) {
|
||||||
// Connect to the database
|
// Connect to the database
|
||||||
try {
|
try {
|
||||||
$pdo = new PDO('mysql:host=localhost;dbname=registry', 'registry-select', 'EPPRegistrySELECT');
|
$c = require_once 'config.php';
|
||||||
|
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$response->header('Content-Type', 'application/json');
|
$response->header('Content-Type', 'application/json');
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'mysql_host' => 'localhost',
|
'db_type' => 'mysql',
|
||||||
'mysql_port' => 3306,
|
'db_host' => 'localhost',
|
||||||
'mysql_database' => 'your_database_name',
|
'db_port' => 3306,
|
||||||
'mysql_username' => 'your_username',
|
'db_database' => 'your_database_name',
|
||||||
'mysql_password' => 'your_password',
|
'db_username' => 'your_username',
|
||||||
'privacy' => false
|
'db_password' => 'your_password',
|
||||||
|
'privacy' => false
|
||||||
];
|
];
|
|
@ -34,8 +34,8 @@ $server->on('connect', function ($server, $fd) {
|
||||||
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
$server->on('receive', function ($server, $fd, $reactorId, $data) {
|
||||||
// Connect to the database
|
// Connect to the database
|
||||||
try {
|
try {
|
||||||
$c = include 'config.php';
|
$c = require_once 'config.php';
|
||||||
$pdo = new PDO("mysql:host=localhost;dbname={$c['mysql_database']}", $c['mysql_username'], $c['mysql_password']);
|
$pdo = new PDO("{$c['db_type']}:host={$c['db_host']};dbname={$c['db_database']}", $c['db_username'], $c['db_password']);
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$server->send($fd, "Error connecting to database");
|
$server->send($fd, "Error connecting to database");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue