1

I'm developing a query module. I need to use some environment variables. I want to configure the module without hardcoding values inside the module. What can I do? I'd like to avoid reading values from external text files.

Is there a way to access Memgraph ENV variables?

Juliette Gia
  • 126
  • 6

1 Answers1

1

In Memmgraph query modules have access to the Memgraph's environment variables. Here is the code that you can use for testing:

import mgp
  
import os
  
home = os.getenv("HOME")
my_env = os.getenv("MY_ENV_VAR")
  
@mgp.read_proc
def procedure() -> mgp.Record():
    print(my_env)
    print(home)
    return mgp.Record()
Taja Jan
  • 942
  • 1
  • 1
  • 11