AdminProperties.java 2.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
 * Copyright 2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.codecentric.boot.admin.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "spring.boot.admin")
public class AdminProperties {

23
	/**
24
	 * The admin server urls to register at
25
	 */
26
	private String[] url;
27

28
	/**
29
	 * The admin rest-apis path.
30
	 */
31
	private String apiPath = "api/applications";
32

33 34 35
	/**
	 * Time interval (in ms) the registration is repeated
	 */
36
	private long period = 10_000L;
37

38 39 40
	/**
	 * Username for basic authentication on admin server
	 */
41 42
	private String username;

43 44 45
	/**
	 * Password for basic authentication on admin server
	 */
46 47
	private String password;

48 49 50
	/**
	 * Enable automatic deregistration on shutdown
	 */
51 52
	private boolean autoDeregistration;

53 54 55 56 57
	/**
	 * Enable automatic registration when the application is ready
	 */
	private boolean autoRegistration = true;

58 59 60 61 62
	/**
	 * Enable registration against one or all admin servers
	 */
	private boolean registerOnce = true;

63 64
	public void setUrl(String[] url) {
		this.url = url.clone();
65
	}
66

67 68
	public String[] getUrl() {
		return url.clone();
69 70
	}

71 72
	public void setApiPath(String apiPath) {
		this.apiPath = apiPath;
73 74
	}

75 76 77 78
	public String getApiPath() {
		return apiPath;
	}

79 80 81 82 83 84
	public String[] getAdminUrl() {
		String adminUrls[] = url.clone();
		for (int i = 0; i < adminUrls.length; i++) {
			adminUrls[i] += "/" + apiPath;
		}
		return adminUrls;
85 86
	}

87
	public long getPeriod() {
88 89 90 91 92 93
		return period;
	}

	public void setPeriod(int period) {
		this.period = period;
	}
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

	public void setUsername(String username) {
		this.username = username;
	}

	public String getUsername() {
		return username;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPassword() {
		return password;
	}
110 111 112 113 114 115 116 117

	public boolean isAutoDeregistration() {
		return autoDeregistration;
	}

	public void setAutoDeregistration(boolean autoDeregistration) {
		this.autoDeregistration = autoDeregistration;
	}
118 119 120 121 122 123 124 125

	public boolean isAutoRegistration() {
		return autoRegistration;
	}

	public void setAutoRegistration(boolean autoRegistration) {
		this.autoRegistration = autoRegistration;
	}
126 127 128 129 130 131 132 133

	public boolean isRegisterOnce() {
		return registerOnce;
	}

	public void setRegisterOnce(boolean registerOnce) {
		this.registerOnce = registerOnce;
	}
134
}