Skip to content

Commit

Permalink
项目优化
Browse files Browse the repository at this point in the history
  • Loading branch information
xxx committed Mar 4, 2018
1 parent b570313 commit b47bf84
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 自定义
/logs

# 系统文件
/target
Expand Down
44 changes: 44 additions & 0 deletions bin/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ========== 自定义 ==========
# 服务端口号
server:
port: 8080

# 代理配置
proxy:
# 访问目标站点所用代理(除 free-ss)
enable: true
host: 127.0.0.1
port: 1080

# 访问 free-ss 时所用代理
free-ss:
enable: false
host: 113.12.72.24
port: 3128
socks: false


# phantomjs 路径
phantomjs:
path: file:lib\phantomjs.exe


# 因 Heroku 应用 30 分钟没有访问会自动休眠,为防止休眠,系统每 20 分钟访问一次该配置地址
health:
url:
cron: 0 0/20 6-23 * * ?


# spring boot 启用调试模式
debug: true


# ========== Spring ==========
spring:
# Spring 数据库
datasource:
platform: h2
driver-class-name: org.h2.Driver
url: jdbc:h2:./data/db
username: sa
password:
2 changes: 2 additions & 0 deletions bin/run.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chcp 65001
java -jar -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Dspring.profiles.active=dev lib/ShadowSocks-Share-0.0.1-SNAPSHOT.jar --spring.config.location=config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public ShadowSocksEntity getShadowSocks() {
cliArgsCap.add("--proxy-type=socks5");*/
cliArgsCap.add("--ssl-protocol=any");
cliArgsCap.add("--script-encoding=utf8");
cliArgsCap.add("--webdriver-logfile=logs/phantomjsdriver.log");
cliArgsCap.add("--webdriver-loglevel=INFO");
cliArgsCap.add("--debug=false");
capability.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, cliArgsCap);
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# ========== 自定义 ==========
# 服务端口号
server:
port: 8080

# 代理配置
proxy:
# 访问目标站点所用代理(除 free-ss)
enable: true
Expand All @@ -15,7 +20,7 @@ proxy:

# phantomjs 路径
phantomjs:
path: file:D:\ssr\phantomjs.exe
path: file:D:\phantomjs.exe


# 因 Heroku 应用 30 分钟没有访问会自动休眠,为防止休眠,系统每 20 分钟访问一次该配置地址
Expand All @@ -32,5 +37,8 @@ debug: true
spring:
# Spring 数据库
datasource:
platform: h2
driver-class-name: org.h2.Driver
url: jdbc:h2:~/test
username: sa
password:
8 changes: 8 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# ========== 自定义 ==========
# 服务端口号
server:
port: 8080

# 代理配置
proxy:
# 访问目标站点所用代理(除 free-ss)
enable: false
Expand Down Expand Up @@ -32,5 +37,8 @@ debug: false
spring:
# Spring 数据库
datasource:
platform: h2
driver-class-name: org.h2.Driver
url: jdbc:h2:~/test
username: sa
password: unrDG0Nb3r4l
8 changes: 0 additions & 8 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ spring:
profiles:
active: prod

# Spring 数据库
datasource:
platform: h2
url: jdbc:h2:~/test
driver-class-name: org.h2.Driver
# username: sa
# password: unrDG0Nb3r4l

# Spring H2 配置
h2:
console:
Expand Down
14 changes: 14 additions & 0 deletions src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
</encoder>
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/ShadowSocks-Share.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/ShadowSocks-Share-%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
</encoder>
<append>false</append>
<prudent>false</prudent>
</appender>

<logger name="com.example.ShadowSocksShare" level="DEBUG"/>

<logger name="org.springframework.web" level="DEBUG"/>
Expand All @@ -16,6 +29,7 @@

<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</springProfile>

Expand Down

0 comments on commit b47bf84

Please sign in to comment.