adding script dir, vault scripts

This commit is contained in:
2025-05-22 10:52:56 +02:00
parent a9f91bb31c
commit 0e58abfb29
10 changed files with 230 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
import json
import sys
def env_to_json(file_path):
# Open dotenv file
with open(file_path, 'r') as file:
# Store dotenv variables in a dict
data = {}
for line in file:
# Ignore comment and empty lines
if line.startswith('#') or not line.strip():
continue
# Split key from value
key, value = line.strip().split("=", 1)
data[key] = value.replace('\'', '').replace('"', '')
# Convert to json
json_data = json.dumps(data, indent=4)
return json_data
def main():
print(env_to_json(sys.argv[1]))
if __name__ == "__main__":
main()