Created
January 19, 2021 20:08
-
-
Save rllola/1f5d115c29d18b1e3067b9104f759563 to your computer and use it in GitHub Desktop.
Get all the environement variable in electron project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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