Skip to content
Snippets Groups Projects
Commit 81b3734d authored by Joe's avatar Joe Committed by agata
Browse files

small corrections to wp-nginx-map.php

parent 02399f88
Branches
No related tags found
No related merge requests found
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
// wp-nginx-map.php // wp-nginx-map.php
// //
// Stampa una mappa delle assegnazioni blog -> backend, per NGINX. // Stampa una mappa delle assegnazioni blog -> backend, per NGINX.
// IP interno del master.
define('NOBLOGS_MASTER', '172.16.1.10');
// Load wordpress api. // Load wordpress api.
define('WP_CACHE',false); define('WP_CACHE',false);
...@@ -24,7 +25,7 @@ function printline($s) { ...@@ -24,7 +25,7 @@ function printline($s) {
function backend_to_http_endpoint($backend) { function backend_to_http_endpoint($backend) {
if (substr($backend, 0, 8) != 'backend_') { if (substr($backend, 0, 8) != 'backend_') {
error_log('diamine, di questo backend non so che farmene: ' . $backend); error_log('diamine, di questo backend non so che farmene: ' . $backend);
return 'localhost:82'; return NOBLOGS_MASTER . ':82';
} }
$id = substr($backend, 8); $id = substr($backend, 8);
return '172.16.1.' . $id . ':82'; return '172.16.1.' . $id . ':82';
...@@ -38,7 +39,7 @@ function generate_map() { ...@@ -38,7 +39,7 @@ function generate_map() {
$blogs = get_blogs(); $blogs = get_blogs();
printline('map $http_host $backend_noblogs {'); printline('map $http_host $backend_noblogs {');
printline(' default http://localhost:82;'); printline(' default http://' . NOBLOGS_MASTER . ':82;');
foreach ($blogs as $blog) { foreach ($blogs as $blog) {
$blog_id = $blog->blog_id; $blog_id = $blog->blog_id;
$backend_id = $wpdb_hash->lookup($blog_id); $backend_id = $wpdb_hash->lookup($blog_id);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment