Skip to content

Instantly share code, notes, and snippets.

@rllola
Created January 19, 2021 20:08
Show Gist options
  • Save rllola/1f5d115c29d18b1e3067b9104f759563 to your computer and use it in GitHub Desktop.
Save rllola/1f5d115c29d18b1e3067b9104f759563 to your computer and use it in GitHub Desktop.
Get all the environement variable in electron project
import re
import glob
javascript_files = glob.glob('**/*.js', recursive=True)
variables = []
for file in javascript_files:
with open(file, 'r') as f:
javascript_blob = f.read()
environnement_variable_regex = re.compile('process\.env\.[a-zA-Z0-9_]+')
m = environnement_variable_regex.findall(javascript_blob)
variables = variables + m
variables = list(set(variables))
print("ET BAM...")
for v in variables:
print(v.split('.')[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment