Skip to content

Commit d942892

Browse files
authored
Merge pull request #17 from deflinhec/develop
Develop
2 parents dd9ff42 + 2616f9a commit d942892

21 files changed

+771
-407
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.vscode/*
22
/build/*
3+
/cmake/httplib/*
34
/include/*
45
/lib/*
5-
/bin/*
6+
/bin/*

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ option(${PROJECT_NAME}_BUILD_BENCHMARK_TESTS "Build benchmark" ON)
3939

4040
set(SERVER_SOURCES
4141
${CMAKE_CURRENT_SOURCE_DIR}/src/gsx2json.cpp
42+
${CMAKE_CURRENT_SOURCE_DIR}/src/cache.cpp
43+
${CMAKE_CURRENT_SOURCE_DIR}/src/utils.cpp
4244
)
4345
set(SERVER_HEADERS
4446
${CMAKE_CURRENT_SOURCE_DIR}/src/gsx2json.h
47+
${CMAKE_CURRENT_SOURCE_DIR}/src/cache.h
48+
${CMAKE_CURRENT_SOURCE_DIR}/src/utils.h
4549
)
4650
set(RESOURCE_FILES
4751
cpp-httplib/example/ca-bundle.crt

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ RUN apk --no-cache add bash \
99
zlib-dev \
1010
supervisor
1111

12-
ENV CC=gcc CXX=g++ TZ=Asia/Taipei
13-
EXPOSE 8080
14-
1512
COPY . /project
1613
WORKDIR /project
17-
RUN /bin/bash scripts/build.sh Release
14+
RUN export CC=gcc CXX=g++ && \
15+
/bin/bash scripts/build.sh Release
16+
17+
EXPOSE 8080
18+
ENV TZ=Asia/Taipei \
19+
ARGUMENTS="--host 0.0.0.0"
1820

1921
COPY supervisor.conf /etc/supervisor.conf
2022
CMD ["supervisord", "-c", "/etc/supervisor.conf"]

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ In this example below I'm going to use `5000` as port, and output log file under
2828
```
2929
3030
```
31-
docker run -it -d -p 5000:8080 -v bin/volume:/workspace --name gsx2jsonpp-latest deflinhec/gsx2jsonpp
31+
docker run -it -d --expose 5000 \
32+
-v ${PWD}/bin/volume:/workspace \
33+
-e ARGUMENTS="--host 0.0.0.0 --port 5000" \
34+
--name gsx2jsonpp-latest deflinhec/gsx2jsonpp
3235
```
3336
3437
- Launch with a local image
@@ -40,9 +43,28 @@ In this example below I'm going to use `5000` as port, and output log file under
4043
```
4144
4245
```
43-
docker run -it -d -p 5000:8080 -v bin/volume:/workspace --name gsx2jsonpp gsx2jsonpp
46+
docker run -it -d --expose 5000 \
47+
-v ${PWD}/bin/volume:/workspace \
48+
-e ARGUMENTS="--host 0.0.0.0 --port 5000" \
49+
--name gsx2jsonpp gsx2jsonpp
4450
```
4551
52+
Avaliable arguments:
53+
- -p, --port
54+
- --host
55+
56+
- --cache (file|memory)
57+
58+
Cache mode is disabled by default, this feature allows client
59+
to query on specific data version. When cache is configure with
60+
file mode, cache file will be preserve under 'cache/' folder.
61+
62+
- --ssl (true|false)
63+
64+
SSL mode is disabled by default, if you prefer using SSL mode
65+
with your certification and private key. Copy your files into
66+
`${PWD}/bin/volume` and rename as `cert.pem, key.pem`.
67+
4668
After launched, Gsx2Jsonpp should be accessable in your browser [localhost:5000](http://localhost:5000/hi).
4769
4870
Supervisor have been setup within the container to guarantee an auto restart after accidentially crashed(hopefully not).
@@ -222,3 +244,5 @@ There are four sections to the returned data.
222244
223245
- :white_check_mark: md5 checksum
224246
247+
- :white_check_mark: cache
248+

0 commit comments

Comments
 (0)