001/*
002 * Copyright 2012-2015 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.devtools.autoconfigure;
018
019/**
020 * Configuration properties for remote Spring Boot applications.
021 *
022 * @author Phillip Webb
023 * @author Rob Winch
024 * @since 1.3.0
025 * @see DevToolsProperties
026 */
027public class RemoteDevToolsProperties {
028
029        public static final String DEFAULT_CONTEXT_PATH = "/.~~spring-boot!~";
030
031        public static final String DEFAULT_SECRET_HEADER_NAME = "X-AUTH-TOKEN";
032
033        /**
034         * Context path used to handle the remote connection.
035         */
036        private String contextPath = DEFAULT_CONTEXT_PATH;
037
038        /**
039         * A shared secret required to establish a connection (required to enable remote
040         * support).
041         */
042        private String secret;
043
044        /**
045         * HTTP header used to transfer the shared secret.
046         */
047        private String secretHeaderName = DEFAULT_SECRET_HEADER_NAME;
048
049        private Restart restart = new Restart();
050
051        private Debug debug = new Debug();
052
053        private Proxy proxy = new Proxy();
054
055        public String getContextPath() {
056                return this.contextPath;
057        }
058
059        public void setContextPath(String contextPath) {
060                this.contextPath = contextPath;
061        }
062
063        public String getSecret() {
064                return this.secret;
065        }
066
067        public void setSecret(String secret) {
068                this.secret = secret;
069        }
070
071        public String getSecretHeaderName() {
072                return this.secretHeaderName;
073        }
074
075        public void setSecretHeaderName(String secretHeaderName) {
076                this.secretHeaderName = secretHeaderName;
077        }
078
079        public Restart getRestart() {
080                return this.restart;
081        }
082
083        public Debug getDebug() {
084                return this.debug;
085        }
086
087        public Proxy getProxy() {
088                return this.proxy;
089        }
090
091        public static class Restart {
092
093                /**
094                 * Enable remote restart.
095                 */
096                private boolean enabled = true;
097
098                public boolean isEnabled() {
099                        return this.enabled;
100                }
101
102                public void setEnabled(boolean enabled) {
103                        this.enabled = enabled;
104                }
105
106        }
107
108        public static class Debug {
109
110                public static final Integer DEFAULT_LOCAL_PORT = 8000;
111
112                /**
113                 * Enable remote debug support.
114                 */
115                private boolean enabled = true;
116
117                /**
118                 * Local remote debug server port.
119                 */
120                private int localPort = DEFAULT_LOCAL_PORT;
121
122                public boolean isEnabled() {
123                        return this.enabled;
124                }
125
126                public void setEnabled(boolean enabled) {
127                        this.enabled = enabled;
128                }
129
130                public int getLocalPort() {
131                        return this.localPort;
132                }
133
134                public void setLocalPort(int localPort) {
135                        this.localPort = localPort;
136                }
137
138        }
139
140        public static class Proxy {
141
142                /**
143                 * The host of the proxy to use to connect to the remote application.
144                 */
145                private String host;
146
147                /**
148                 * The port of the proxy to use to connect to the remote application.
149                 */
150                private Integer port;
151
152                public String getHost() {
153                        return this.host;
154                }
155
156                public void setHost(String host) {
157                        this.host = host;
158                }
159
160                public Integer getPort() {
161                        return this.port;
162                }
163
164                public void setPort(Integer port) {
165                        this.port = port;
166                }
167
168        }
169
170}