Commit 6eb807ee authored by Vir Chaudhury's avatar Vir Chaudhury
Browse files

isolate: patch to take config file by environment variable

parent 0642b663
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ stdenv.mkDerivation rec {
    systemdLibs.dev
  ];

  patches = [
    ./take-config-file-from-env.patch
  ];

  installPhase = ''
    runHook preInstall
+19 −0
Original line number Diff line number Diff line
diff --git a/config.c b/config.c
index 6477259..c462ed3 100644
--- a/config.c
+++ b/config.c
@@ -114,9 +114,12 @@ cf_check(void)
 void
 cf_parse(void)
 {
-  FILE *f = fopen(CONFIG_FILE, "r");
+  char *config_file = getenv("ISOLATE_CONFIG_FILE");
+  if(!config_file)
+    die("ISOLATE_CONFIG_FILE environment variable not set");
+  FILE *f = fopen(config_file, "r");
   if (!f)
-    die("Cannot open %s: %m", CONFIG_FILE);
+    die("Cannot open %s: %m", config_file);
 
   char line[MAX_LINE_LEN];
   while (fgets(line, sizeof(line), f))