Have DB setup warn about "localhost"

This commit is contained in:
Joseph Schorr 2015-02-09 17:55:46 -05:00
parent 70270b09be
commit b91930dba2
2 changed files with 13 additions and 1 deletions

View file

@ -3,6 +3,16 @@ function SetupCtrl($scope, $timeout, ApiService, Features, UserService, Containe
return;
}
$scope.HOSTNAME_REGEX = '^[a-zA-Z-0-9\.]+(:[0-9]+)?$';
$scope.validateHostname = function(hostname) {
if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
}
return null;
};
// Note: The values of the enumeration are important for isStepFamily. For example,
// *all* states under the "configuring db" family must start with "config-db".
$scope.States = {

View file

@ -163,7 +163,9 @@
<td>Database Server:</td>
<td>
<span class="config-string-field" binding="fields.server"
placeholder="dbserverhost"></span>
placeholder="dbserverhost"
pattern="{{ HOSTNAME_REGEX }}"
validator="validateHostname(value)">></span>
<div class="help-text">
The server (and optionally, custom port) where the database lives
</div>