from subgraph_extractor.cli import extract_from_config
import click
from cloudpathlib import AnyPath

@click.command()
@click.option(
    "--subgraph-config-folder",
    help="The folder containing the subgraph config files",
    default='config',
)
@click.option(
    "--database-string",
    default="postgresql://graph-node:let-me-in@localhost:5432/graph-node",
    help="The database string for connections, defaults to a local graph-node",
)
@click.option(
    "--output-location",
    default="data",
    help="The base output location, whether local or cloud",
)
def export(subgraph_config_folder, database_string, output_location):
    for file_name in AnyPath(subgraph_config_folder).glob('*.yaml'):
        extract_from_config(
            file_name,
            database_string,
            output_location
        )

if __name__ == "__main__":
    export()
@@ -94,16 +94,27 @@
 AnyPath%0A
+import os%0A%0A
 %0A@click.
@@ -246,16 +246,16 @@
 ult=
-'
+%22
 config
-'
+%22
 ,%0A)%0A
@@ -306,16 +306,70 @@
 default=
+os.environ.get(%0A        %22SE_DATABASE_STRING%22,%0A        
 %22postgre
@@ -423,16 +423,23 @@
 -node%22,%0A
+    ),%0A
     help
@@ -475,19 +475,19 @@
 nections
-, d
+. D
 efaults 
@@ -489,16 +489,53 @@
 ults to 
+SE_DATABASE_STRING if set, otherwise 
 a local 
@@ -605,14 +605,52 @@
 ult=
+os.environ.get(%22SE_OUTPUT_LOCATION%22, 
 %22data%22
+)
 ,%0A  
@@ -705,16 +705,87 @@
 or cloud
+. Defaults to SE_OUTPUT_LOCATION if set, otherwise a folder called data
 %22,%0A)%0Adef
@@ -913,16 +913,16 @@
 lob(
-'
+%22
 *.yaml
-'
+%22
 ):%0A 
@@ -952,43 +952,18 @@
 fig(
-%0A            file_name,%0A           
+file_name,
  dat
@@ -979,20 +979,8 @@
 ing,
-%0A           
  out
@@ -995,18 +995,10 @@
 tion
-%0A        
 )
+%0A
 %0A%0Aif
@@ -1034,8 +1034,9 @@
 export()
+%0A

Support environment variables for the extraction