mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-01 00:52:16 +00:00
Remove the need for DIGWATCH_LUA_DIR env var
This commit is contained in:
parent
c7d0c7dbd9
commit
dcbae750c8
@ -34,12 +34,7 @@ $ make
|
||||
as a result, you should have a digwatch executable `build/userspace/digwatch/digwatch`.
|
||||
|
||||
|
||||
### Running
|
||||
|
||||
Set the path of the digwatch lua directory in the env var `DIGWATCH_LUA_DIR`:
|
||||
|
||||
`export DIGWATCH_LUA_DIR=<path_to_digwatch>/userspace/digwatch/lua/`
|
||||
|
||||
### Running locally-built sysdig
|
||||
|
||||
|
||||
Create a file with some [digwatch rules](Rule-syntax-and-design). For example:
|
||||
|
@ -3,6 +3,8 @@
|
||||
#define DIGWATCH_VERSION "${DIGWATCH_VERSION}"
|
||||
|
||||
#define DIGWATCH_LUA_DIR "/usr/share/digwatch/lua/"
|
||||
#define DIGWATCH_SOURCE_LUA_DIR "${PROJECT_SOURCE_DIR}/userspace/digwatch/lua/"
|
||||
|
||||
|
||||
#define DIGWATCH_LUA_MAIN "${DIGWATCH_LUA_MAIN}"
|
||||
|
||||
|
@ -262,14 +262,21 @@ int digwatch_init(int argc, char **argv)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
//
|
||||
char* env_lua_dir = getenv("DIGWATCH_LUA_DIR");
|
||||
if(env_lua_dir)
|
||||
lua_main_filename = lua_dir + DIGWATCH_LUA_MAIN;
|
||||
if (!std::ifstream(lua_main_filename))
|
||||
{
|
||||
lua_dir = string(env_lua_dir);
|
||||
lua_dir = DIGWATCH_SOURCE_LUA_DIR;
|
||||
lua_main_filename = lua_dir + DIGWATCH_LUA_MAIN;
|
||||
if (!std::ifstream(lua_main_filename))
|
||||
{
|
||||
fprintf(stderr, "Could not find Digwatch Lua libraries (tried %s, %s). \n",
|
||||
DIGWATCH_LUA_DIR DIGWATCH_LUA_MAIN,
|
||||
lua_main_filename.c_str());
|
||||
result = EXIT_FAILURE;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
lua_main_filename = lua_dir + DIGWATCH_LUA_MAIN;
|
||||
|
||||
// Initialize Lua interpreter
|
||||
ls = lua_open();
|
||||
|
Loading…
Reference in New Issue
Block a user