Commit a23462b5 authored by Joe's avatar Joe Committed by lechuck

small corrections to wp-nginx-map.php

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