mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-02-15 02:53:07 +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
|
||||
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
|
||||
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
|
||||
|
||||
@ -240,15 +249,15 @@ libstorage:
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
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 # "variables.mk" was not included
|
||||
|
||||
@ -27,6 +27,8 @@ from ../../../codex/codex import CodexServer, new, start, stop, close
|
||||
logScope:
|
||||
topics = "libstorage libstoragelifecycle"
|
||||
|
||||
const LibstorageDisableRestApi* {.booldefine.} = true
|
||||
|
||||
type NodeLifecycleMsgType* = enum
|
||||
CREATE_NODE
|
||||
START_NODE
|
||||
@ -139,7 +141,11 @@ proc createStorage(
|
||||
return err("Failed to create Storage: unable to get the private key.")
|
||||
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 =
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user