You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2018/06/20 13:12:47 UTC

[incubator-skywalking] 01/02: Modify startup script and add webapp.yml config file

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch webapp/login
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit bf58b56b144dcffb8aa62bed3c7b36450d4f3f57
Author: gaohongtao <ha...@gmail.com>
AuthorDate: Wed Jun 20 21:02:32 2018 +0800

    Modify startup script and add webapp.yml config file
---
 apm-dist/bin/webappService.bat                               |  2 +-
 apm-dist/bin/webappService.sh                                |  3 +--
 apm-dist/src/main/assembly/binary.xml                        |  5 +++++
 .../main/{resources/application.yml => assembly/webapp.yml}  | 12 ++----------
 .../apache/skywalking/apm/webapp/security/ReaderAccount.java |  4 ++--
 apm-webapp/src/main/resources/application.yml                |  2 --
 .../org/apache/skywalking/apm/webapp/security/LoginTest.java |  4 ++--
 .../skywalking/apm/webapp/security/ReaderAccountTest.java    |  2 +-
 8 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/apm-dist/bin/webappService.bat b/apm-dist/bin/webappService.bat
index 1627db4..049164a 100644
--- a/apm-dist/bin/webappService.bat
+++ b/apm-dist/bin/webappService.bat
@@ -37,5 +37,5 @@ if not defined JAVA_HOME (
  set _EXECJAVA=java
 )
 
-start "%WEBAPP_PROCESS_TITLE%" %_EXECJAVA%  -jar %JARPATH%/skywalking-webapp.jar --server.port=8080 --collector.ribbon.listOfServers=127.0.0.1:10800 --logging.file=%LOG_FILE_LOCATION% --collector.ribbon.ReadTimeout=10000
+start "%WEBAPP_PROCESS_TITLE%" %_EXECJAVA%  -jar %JARPATH%/skywalking-webapp.jar --spring.config.location=%JAR_PATH%/webapp.yml --logging.file=%LOG_FILE_LOCATION%
 endlocal
diff --git a/apm-dist/bin/webappService.sh b/apm-dist/bin/webappService.sh
index 194e8d9..df0040d 100644
--- a/apm-dist/bin/webappService.sh
+++ b/apm-dist/bin/webappService.sh
@@ -34,9 +34,8 @@ _RUNJAVA=${JAVA_HOME}/bin/java
 [ -z "$JAVA_HOME" ] && _RUNJAVA=java
 
 eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} -jar ${JAR_PATH}/skywalking-webapp.jar \
-         --server.port=8080 --collector.ribbon.listOfServers=127.0.0.1:10800 \
+         --spring.config.location=${JAR_PATH}/webapp.yml \
          --logging.file=${LOG_FILE_LOCATION} \
-         --collector.ribbon.ReadTimeout=10000 \
         2>${WEBAPP_LOG_DIR}/webapp-console.log 1> /dev/null &"
 
 if [ $? -eq 0 ]; then
diff --git a/apm-dist/src/main/assembly/binary.xml b/apm-dist/src/main/assembly/binary.xml
index afdb0c0..193e693 100644
--- a/apm-dist/src/main/assembly/binary.xml
+++ b/apm-dist/src/main/assembly/binary.xml
@@ -75,5 +75,10 @@
             <outputDirectory>/webapp</outputDirectory>
             <fileMode>0644</fileMode>
         </file>
+        <file>
+            <source>${project.basedir}/../apm-webapp/src/main/assembly/webapp.yml</source>
+            <outputDirectory>/webapp</outputDirectory>
+            <fileMode>0644</fileMode>
+        </file>
     </files>
 </assembly>
diff --git a/apm-webapp/src/main/resources/application.yml b/apm-webapp/src/main/assembly/webapp.yml
similarity index 79%
copy from apm-webapp/src/main/resources/application.yml
copy to apm-webapp/src/main/assembly/webapp.yml
index d63d17c..007f3f6 100644
--- a/apm-webapp/src/main/resources/application.yml
+++ b/apm-webapp/src/main/assembly/webapp.yml
@@ -16,22 +16,14 @@
 
 server:
   port: 8080
-zuul:
-  ignoredServices: '*'
-  routes:
-    api:
-      path: /api/**
-      serviceId: collector
 
 collector:
   path: /graphql
   ribbon:
+    ReadTimeout: 10000
     listOfServers: 127.0.0.1:10800
-    NIWSServerListClassName: org.apache.skywalking.apm.webapp.tools.CollectorServerList
 
 security:
   user:
     admin:
-      password: admin
-    guest:
-      password:
+      password: 111
diff --git a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/security/ReaderAccount.java b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/security/ReaderAccount.java
index 8cd27c5..b72ca6c 100644
--- a/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/security/ReaderAccount.java
+++ b/apm-webapp/src/main/java/org/apache/skywalking/apm/webapp/security/ReaderAccount.java
@@ -14,7 +14,7 @@ class ReaderAccount implements Account {
     private final static Gson GSON = new GsonBuilder().disableHtmlEscaping()
         .setLenient().create();
     
-    private String username;
+    private String userName;
     
     private String password;
     
@@ -23,7 +23,7 @@ class ReaderAccount implements Account {
     }
     
     public String userName() {
-        return username;
+        return userName;
     }
     
     public String password() {
diff --git a/apm-webapp/src/main/resources/application.yml b/apm-webapp/src/main/resources/application.yml
index d63d17c..69e5c96 100644
--- a/apm-webapp/src/main/resources/application.yml
+++ b/apm-webapp/src/main/resources/application.yml
@@ -33,5 +33,3 @@ security:
   user:
     admin:
       password: admin
-    guest:
-      password:
diff --git a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/LoginTest.java b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/LoginTest.java
index 3e2dd57..972230b 100644
--- a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/LoginTest.java
+++ b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/LoginTest.java
@@ -44,7 +44,7 @@ public class LoginTest {
 
     @Test
     public void assertSuccessLogin() throws IOException {
-        when(request.getReader()).thenReturn(new BufferedReader(new StringReader("{\"username\": \"admin\", \"password\":\"admin\"}")));
+        when(request.getReader()).thenReturn(new BufferedReader(new StringReader("{\"userName\": \"admin\", \"password\":\"admin\"}")));
         loginFilter.run();
         assertHeaderAndStatusCode();
         verify(ctx).setResponseBody("{\"status\":\"ok\",\"currentAuthority\":\"admin\"}");
@@ -52,7 +52,7 @@ public class LoginTest {
     
     @Test
     public void assertFailLogin() throws IOException {
-        when(request.getReader()).thenReturn(new BufferedReader(new StringReader("{\"username\": \"admin\", \"password\":\"888888\"}")));
+        when(request.getReader()).thenReturn(new BufferedReader(new StringReader("{\"userName\": \"admin\", \"password\":\"888888\"}")));
         loginFilter.run();
         assertHeaderAndStatusCode();
         verify(ctx).setResponseBody("{\"status\":\"error\",\"currentAuthority\":\"guest\"}");
diff --git a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/ReaderAccountTest.java b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/ReaderAccountTest.java
index 962e68b..00b9e1b 100644
--- a/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/ReaderAccountTest.java
+++ b/apm-webapp/src/test/java/org/apache/skywalking/apm/webapp/security/ReaderAccountTest.java
@@ -11,7 +11,7 @@ public class ReaderAccountTest {
 
     @Test
     public void assertNewReaderAccount() {
-        Account account = ReaderAccount.newReaderAccount(new BufferedReader(new StringReader("{\"username\": \"admin\", \"password\":\"888888\"}")));
+        Account account = ReaderAccount.newReaderAccount(new BufferedReader(new StringReader("{\"userName\": \"admin\", \"password\":\"888888\"}")));
         assertThat(account.userName(), is("admin"));
         assertThat(account.password(), is("888888"));
     }