Re-add full -web.external-url functionality
Fixes https://github.com/prometheus/alertmanager/issues/212
This commit is contained in:
parent
22b37c831a
commit
20739cc6ad
14
main.go
14
main.go
|
@ -23,6 +23,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
@ -140,6 +141,11 @@ func main() {
|
|||
return n
|
||||
}
|
||||
|
||||
amURL, err := extURL(*externalURL)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reload := func() (err error) {
|
||||
log.With("file", *configFile).Infof("Loading configuration file")
|
||||
defer func() {
|
||||
|
@ -163,9 +169,7 @@ func main() {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tmpl.ExternalURL, err = extURL(*externalURL); err != nil {
|
||||
return err
|
||||
}
|
||||
tmpl.ExternalURL = amURL
|
||||
|
||||
disp.Stop()
|
||||
|
||||
|
@ -183,8 +187,8 @@ func main() {
|
|||
|
||||
router := route.New()
|
||||
|
||||
RegisterWeb(router)
|
||||
api.Register(router.WithPrefix("/api"))
|
||||
RegisterWeb(router.WithPrefix(amURL.Path))
|
||||
api.Register(router.WithPrefix(path.Join(amURL.Path, "/api")))
|
||||
|
||||
go listen(router)
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,32 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" ng-app="am">
|
||||
<head>
|
||||
<script src="/lib/jquery.min.js"></script>
|
||||
<script src="/lib/moment.min.js"></script>
|
||||
<script src="lib/jquery.min.js"></script>
|
||||
<script src="lib/moment.min.js"></script>
|
||||
|
||||
<script src="/lib/angular.min.js"></script>
|
||||
<script src="/lib/angular-sanitize.min.js"></script>
|
||||
<script src="/lib/angular-route.min.js"></script>
|
||||
<script src="/lib/angular-resource.min.js"></script>
|
||||
<script src="/lib/angular-moment.min.js"></script>
|
||||
<script src="lib/angular.min.js"></script>
|
||||
<script src="lib/angular-sanitize.min.js"></script>
|
||||
<script src="lib/angular-route.min.js"></script>
|
||||
<script src="lib/angular-resource.min.js"></script>
|
||||
<script src="lib/angular-moment.min.js"></script>
|
||||
|
||||
<script src="/app/js/app.js"></script>
|
||||
<script src="app/js/app.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="/lib/kube.min.css">
|
||||
<link rel="stylesheet" href="/app/css/main.css">
|
||||
<link rel="stylesheet" href="lib/kube.min.css">
|
||||
<link rel="stylesheet" href="app/css/main.css">
|
||||
|
||||
<title>AlertManager – Prometheus</title>
|
||||
</head>
|
||||
<body>
|
||||
<header class="group">
|
||||
<h1 id="logo" class="thin hide-for-small">
|
||||
<a href="/#/">Alert<span style="font-style: italic; color: #d3d3d3">manager</span></a>
|
||||
<a href="#/">Alert<span style="font-style: italic; color: #d3d3d3">manager</span></a>
|
||||
</h1>
|
||||
|
||||
<nav id="top-nav" ng-controller="NavCtrl">
|
||||
<ul>
|
||||
<li ng-repeat="item in items" ng-class="{'selected': selected(item)}">
|
||||
<a ng-href="/#{{ item.url }}" class="upper">{{ item.name }}</a>
|
||||
<a ng-href="#{{ item.url }}" class="upper">{{ item.name }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -9,7 +9,7 @@ angular.module('am.directives').directive('route',
|
|||
scope: {
|
||||
route: '='
|
||||
},
|
||||
templateUrl: '/app/partials/route.html',
|
||||
templateUrl: 'app/partials/route.html',
|
||||
compile: function(element) {
|
||||
// Use the compile function from the RecursionHelper,
|
||||
// And return the linking function(s) which it returns
|
||||
|
@ -27,7 +27,7 @@ angular.module('am.directives').directive('alert',
|
|||
alert: '=',
|
||||
group: '='
|
||||
},
|
||||
templateUrl: '/app/partials/alert.html'
|
||||
templateUrl: 'app/partials/alert.html'
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ angular.module('am.directives').directive('silence',
|
|||
scope: {
|
||||
sil: '='
|
||||
},
|
||||
templateUrl: '/app/partials/silence.html'
|
||||
templateUrl: 'app/partials/silence.html'
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -51,7 +51,7 @@ angular.module('am.directives').directive('silenceForm',
|
|||
scope: {
|
||||
silence: '='
|
||||
},
|
||||
templateUrl: '/app/partials/silence-form.html'
|
||||
templateUrl: 'app/partials/silence-form.html'
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -65,19 +65,19 @@ angular.module('am.services').factory('Silence',
|
|||
}, {
|
||||
'query': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/silences'
|
||||
url: 'api/v1/silences'
|
||||
},
|
||||
'create': {
|
||||
method: 'POST',
|
||||
url: '/api/v1/silences'
|
||||
url: 'api/v1/silences'
|
||||
},
|
||||
'get': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/silence/:id'
|
||||
url: 'api/v1/silence/:id'
|
||||
},
|
||||
'delete': {
|
||||
method: 'DELETE',
|
||||
url: '/api/v1/silence/:id'
|
||||
url: 'api/v1/silence/:id'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ angular.module('am.services').factory('Alert',
|
|||
return $resource('', {}, {
|
||||
'query': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/alerts'
|
||||
url: 'api/v1/alerts'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ angular.module('am.services').factory('AlertGroups',
|
|||
return $resource('', {}, {
|
||||
'query': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/alerts/groups'
|
||||
url: 'api/v1/alerts/groups'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ angular.module('am.services').factory('Alert',
|
|||
return $resource('', {}, {
|
||||
'query': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/alerts'
|
||||
url: 'api/v1/alerts'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -121,13 +121,13 @@ angular.module('am.controllers').controller('NavCtrl',
|
|||
function($scope, $location) {
|
||||
$scope.items = [{
|
||||
name: 'Silences',
|
||||
url: '/silences'
|
||||
url: 'silences'
|
||||
}, {
|
||||
name: 'Alerts',
|
||||
url: '/alerts'
|
||||
url: 'alerts'
|
||||
}, {
|
||||
name: 'Status',
|
||||
url: '/status'
|
||||
url: 'status'
|
||||
}];
|
||||
|
||||
$scope.selected = function(item) {
|
||||
|
@ -372,7 +372,7 @@ angular.module('am.services').factory('Status',
|
|||
return $resource('', {}, {
|
||||
'get': {
|
||||
method: 'GET',
|
||||
url: '/api/v1/status'
|
||||
url: 'api/v1/status'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -406,17 +406,17 @@ angular.module('am').config(
|
|||
function($routeProvider) {
|
||||
$routeProvider.
|
||||
when('/alerts', {
|
||||
templateUrl: '/app/partials/alerts.html',
|
||||
templateUrl: 'app/partials/alerts.html',
|
||||
controller: 'AlertsCtrl',
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/silences', {
|
||||
templateUrl: '/app/partials/silences.html',
|
||||
templateUrl: 'app/partials/silences.html',
|
||||
controller: 'SilencesCtrl',
|
||||
reloadOnSearch: false
|
||||
}).
|
||||
when('/status', {
|
||||
templateUrl: '/app/partials/status.html',
|
||||
templateUrl: 'app/partials/status.html',
|
||||
controller: 'StatusCtrl'
|
||||
}).
|
||||
otherwise({
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue