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

small corrections to wp-nginx-map.php

parent d7b3feb6
Branches
Tags
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment