mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-05-21 10:49:49 +00:00
feat(libstorage): enable rest api in libstorage in debug builds (#1406)
This commit is contained in:
parent
3830ecc9e6
commit
d02f44ffd6
17
Makefile
17
Makefile
@ -64,6 +64,15 @@ else
|
|||||||
endif
|
endif
|
||||||
export CXXFLAGS
|
export CXXFLAGS
|
||||||
|
|
||||||
|
LIBSTORAGE_PARAMS :=
|
||||||
|
# By default, libstorage disables the restapi. To build libstorage with the rest
|
||||||
|
# api enabled for remote debugging, use `make DEBUG=1 libstorage`
|
||||||
|
ifeq ($(DEBUG),1)
|
||||||
|
LIBSTORAGE_PARAMS := $(LIBSTORAGE_PARAMS) -d:LibstorageDisableRestApi=0
|
||||||
|
else ifeq ($(DEBUG),0)
|
||||||
|
LIBSTORAGE_PARAMS := $(LIBSTORAGE_PARAMS) -d:LibstorageDisableRestApi=1
|
||||||
|
endif
|
||||||
|
|
||||||
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
||||||
|
|
||||||
@ -240,15 +249,15 @@ libstorage:
|
|||||||
|
|
||||||
ifeq ($(STATIC), 1)
|
ifeq ($(STATIC), 1)
|
||||||
echo -e $(BUILD_MSG) "build/$@.a" && \
|
echo -e $(BUILD_MSG) "build/$@.a" && \
|
||||||
$(ENV_SCRIPT) nim libstorageStatic $(NIM_PARAMS) codex.nims
|
$(ENV_SCRIPT) nim libstorageStatic $(NIM_PARAMS) $(LIBSTORAGE_PARAMS) codex.nims
|
||||||
else ifeq ($(detected_OS),Windows)
|
else ifeq ($(detected_OS),Windows)
|
||||||
echo -e $(BUILD_MSG) "build/$@.dll" && \
|
echo -e $(BUILD_MSG) "build/$@.dll" && \
|
||||||
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) codex.nims
|
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) $(LIBSTORAGE_PARAMS) codex.nims
|
||||||
else ifeq ($(detected_OS),macOS)
|
else ifeq ($(detected_OS),macOS)
|
||||||
echo -e $(BUILD_MSG) "build/$@.dylib" && \
|
echo -e $(BUILD_MSG) "build/$@.dylib" && \
|
||||||
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) codex.nims
|
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) $(LIBSTORAGE_PARAMS) codex.nims
|
||||||
else
|
else
|
||||||
echo -e $(BUILD_MSG) "build/$@.so" && \
|
echo -e $(BUILD_MSG) "build/$@.so" && \
|
||||||
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) codex.nims
|
$(ENV_SCRIPT) nim libstorageDynamic $(NIM_PARAMS) $(LIBSTORAGE_PARAMS) codex.nims
|
||||||
endif
|
endif
|
||||||
endif # "variables.mk" was not included
|
endif # "variables.mk" was not included
|
||||||
|
|||||||
@ -27,6 +27,8 @@ from ../../../codex/codex import CodexServer, new, start, stop, close
|
|||||||
logScope:
|
logScope:
|
||||||
topics = "libstorage libstoragelifecycle"
|
topics = "libstorage libstoragelifecycle"
|
||||||
|
|
||||||
|
const LibstorageDisableRestApi* {.booldefine.} = true
|
||||||
|
|
||||||
type NodeLifecycleMsgType* = enum
|
type NodeLifecycleMsgType* = enum
|
||||||
CREATE_NODE
|
CREATE_NODE
|
||||||
START_NODE
|
START_NODE
|
||||||
@ -139,7 +141,11 @@ proc createStorage(
|
|||||||
return err("Failed to create Storage: unable to get the private key.")
|
return err("Failed to create Storage: unable to get the private key.")
|
||||||
let pk = privateKey.get()
|
let pk = privateKey.get()
|
||||||
|
|
||||||
conf.apiBindAddress = string.none
|
when LibstorageDisableRestApi:
|
||||||
|
conf.apiBindAddress = string.none
|
||||||
|
debug "Rest API is disabled!"
|
||||||
|
else:
|
||||||
|
debug "Rest API is enabled!"
|
||||||
|
|
||||||
let server =
|
let server =
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user