dotenv fix, gitignore update

frdel committed Nov 18, 2024 at 09:01 UTC ba3422d45228c53704ef3b896f85909be625c7f2
4 files changed +23 -49
.gitignore
+19 -42
@@ -1,68 +1,45 @@
1 +# Ignore common unwanted files globally
2 **/.DS_Store
3 **/.env
4 **/__pycache__/
5 **/.conda/
6
6 -# Ignore git (for bundler)
7 +# Ignore git internal files (for bundler)
8 .git/
9
10 # Ignore all contents of the virtual environment directory
11 .venv/
12
12 -# ignore all folders under /bundle
13 +# Handle bundle directory
14 bundle/*/
14 -# except some
15 !bundle/mac_pkg_scripts
16
17 -# Ignore all contents of the directory "work_dir"
17 +# Handle work_dir directory
18 work_dir/*
19 -# But do not ignore the directory itself
20 -!work_dir/.gitkeep
19
22 -# Ignore all contents of the directory "memory"
23 -memory/*
24 -# But do not ignore the directory itself
25 -!memory/.gitkeep
20 +# Handle memory directory
21 +memory/**
22 +!memory/**/
23
27 -# Ignore all contents of the directory "logs"
24 +# Handle logs directory
25 logs/*
29 -# But do not ignore the directory itself
30 -!logs/.gitkeep
26
32 -# Ignore all contents of the directory "tmp"
27 +# Handle tmp directory
28 tmp/*
34 -# But do not ignore the directory itself
35 -!tmp/.gitkeep
29
37 -# Ignore everything in the "knowledge" directory
38 -knowledge/*
39 -
40 -# Do not ignore subdirectories (so we can track .gitkeep)
41 -!knowledge/*/
42 -
43 -# Ignore all files within subdirectories (except .gitkeep)
44 -knowledge/**/*.*
45 -!knowledge/**/.gitkeep
46 -
47 -# Explicitly allow the default folder and its contents
30 +# Handle knowledge directory
31 +knowledge/**
32 +!knowledge/**/
33 +# Explicitly allow the default folder in knowledge
34 !knowledge/default/
35 !knowledge/default/**
36
51 -# Ignore everything in the "instruments" directory
52 -instruments/*
53 -
54 -# Do not ignore subdirectories (so we can track .gitkeep)
55 -!instruments/*/
56 -
57 -# Ignore all files within subdirectories (except .gitkeep)
58 -instruments/**/*.*
59 -!instruments/**/.gitkeep
60 -
61 -# Explicitly allow the default folder and its contents
37 +# Handle instruments directory
38 +instruments/**
39 +!instruments/**/
40 +# Explicitly allow the default folder in instruments
41 !instruments/default/
42 !instruments/default/**
43
65 -# Ignore all contents of the directory "bin"
66 -bin/*
67 -# But do not ignore the directory itself
68 -!bin/.gitkeep
44 +# Global rule to include .gitkeep files anywhere
45 +!**/.gitkeep
\ No newline at end of file
memory/default/.gitkeep renamed
python/helpers/cloudflare_tunnel.py
+1 -1
@@ -8,7 +8,7 @@ from python.helpers import files
8 class CloudflareTunnel:
9 def __init__(self, port: int):
10 self.port = port
11 - self.bin_dir = "bin" # Relative path
11 + self.bin_dir = "tmp" # Relative path
12 self.cloudflared_path = None
13 self.tunnel_process = None
14 self.tunnel_url = None
python/helpers/dotenv.py
+3 -6
@@ -27,13 +27,10 @@ def save_dotenv_value(key: str, value: str):
27 found = False
28 for i, line in enumerate(lines):
29 if re.match(rf"^\s*{key}\s*=", line):
30 - if value == "":
31 - del lines[i]
32 - else:
33 - lines[i] = f"{key}={value}\n"
30 + lines[i] = f"{key}={value}\n"
31 found = True
35 - if not found and value != "":
36 - lines.append(f"\n{key}={value}")
32 + if not found:
33 + lines.append(f"\n{key}={value}\n")
34 f.seek(0)
35 f.writelines(lines)
36 f.truncate()