diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a42c9f5..0d9b4d0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,7 @@ set(NEURON_SOURCES src/core/plugin_manager.c src/core/datatag_table.c src/adapter/adapter.c - src/adapter/web_server.c - ) + src/adapter/neu_webserver.c) set(NEURON_INCLUDE_DIRECTORIES include src) add_executable(neuron) diff --git a/README.md b/README.md index 90877b16..7ef170d3 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,10 @@ NEURON IIoT System for Industry 4.0 $ brew install ossp-uuid ``` +- [neuron-dashboard](https://github.com/neugates/neuron-dashboard-src/releases) + ```shell + # Download lastest neuron-dashboard release from https://github.com/neugates/neuron-dashboard-src/releases + # Unzip and move to "build" + + $ unzip neuron-dashboard.zip -d build + ``` diff --git a/src/adapter/web_server.c b/src/adapter/neu_webserver.c similarity index 99% rename from src/adapter/web_server.c rename to src/adapter/neu_webserver.c index 16e6d8d1..a4861040 100644 --- a/src/adapter/web_server.c +++ b/src/adapter/neu_webserver.c @@ -37,7 +37,7 @@ #include "neu_log.h" #include "neu_panic.h" #include "neu_plugin.h" -#include "web_server.h" +#include "neu_webserver.h" // utility function @@ -263,6 +263,14 @@ void rest_start(uint16_t port) nng_url * url; int rv; + char source[256] = {0}; + + getcwd(source, 256); + + strcat(source, "/dist"); + + log_debug("source dir: %s", source); + if ((rv = nng_mtx_alloc(&job_lock)) != 0) { fatal("nng_mtx_alloc", rv); } @@ -311,7 +319,7 @@ void rest_start(uint16_t port) } // Specify local directory for root url "/" - rv = nng_http_handler_alloc_directory(&handler_file, "", "./dist"); + rv = nng_http_handler_alloc_directory(&handler_file, "", source); if (rv != 0) { fatal("nng_http_handler_alloc_file", rv); } diff --git a/src/adapter/web_server.h b/src/adapter/neu_webserver.h similarity index 94% rename from src/adapter/web_server.h rename to src/adapter/neu_webserver.h index 318e67ed..9ca184ac 100644 --- a/src/adapter/web_server.h +++ b/src/adapter/neu_webserver.h @@ -17,8 +17,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#ifndef __WEB_SERVER_H__ -#define __WEB_SERVER_H__ +#ifndef __NEU_WEB_SERVER_H__ +#define __NEU_WEB_SERVER_H__ #define REST_URL "http://0.0.0.0:%u/api/v2" #define DEFAULT_PORT 7000 diff --git a/src/main.c b/src/main.c index 69f5c33e..ff4874cf 100644 --- a/src/main.c +++ b/src/main.c @@ -27,11 +27,11 @@ #include #include -#include "adapter/web_server.h" #include "core/neu_manager.h" #include "neu_log.h" #include "neu_panic.h" #include "utils/idhash.h" +#include "adapter/neu_webserver.h" static nng_thread *web_thread; static nng_mtx * log_mtx;