Skip to content

Commit 6d966c9

Browse files
authored
Merge pull request #16 from OpenShock/feature/dotenv-vars
Start implementing dotenv vars
2 parents 170759e + 27b1dd3 commit 6d966c9

22 files changed

+583
-276
lines changed

.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OPENSHOCK_API_DOMAIN=api.shocklink.net
2+
OPENSHOCK_FW_VERSION=0.8.1

.env.development

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LOG_LEVEL=VERBOSE

.env.production

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LOG_LEVEL=INFO

.github/workflows/ci-build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jobs:
153153
- uses: actions/checkout@v4
154154
with:
155155
sparse-checkout: |
156+
scripts
156157
boards
157158
158159
- uses: actions/setup-python@v4
@@ -175,7 +176,7 @@ jobs:
175176

176177
- name: Merge flash image
177178
run: |
178-
python merge_image.py ${{ matrix.board }} &&
179+
python scripts/merge_image.py ${{ matrix.board }} &&
179180
mv merged.bin OpenShock.${{ matrix.board }}.bin
180181
181182
- name: Upload merged flashable image

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77

88
# data/www is autogenerated by the build process, ignore it:
99
data/www
10+
11+
# ignore local config files
12+
*.local

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,6 @@
9494
"editor.defaultFormatter": "esbenp.prettier-vscode",
9595
"editor.formatOnSave": true
9696
},
97-
"python.analysis.typeCheckingMode": "basic"
97+
"python.analysis.typeCheckingMode": "basic",
98+
"black-formatter.args": ["--line-length", "120", "--skip-string-normalization"]
9899
}

build_frontend.py

-206
This file was deleted.

embed_version.py

-17
This file was deleted.

install_boards.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
config = configparser.ConfigParser()
99
config.read('platformio.io')
1010

11-
source_dir = Path().absolute() / "boards"
12-
target_dir = Path.home() / ".platformio" / "boards"
11+
source_dir = Path().absolute() / 'boards'
12+
target_dir = Path.home() / '.platformio' / 'boards'
13+
1314

1415
def create_boards_dir():
1516
os.makedirs(target_dir, exist_ok=True)
1617

18+
1719
def wipe_installed_boards():
1820
print('Wiping installed boards')
1921
for filename in os.listdir(target_dir):
@@ -27,17 +29,20 @@ def wipe_installed_boards():
2729
except Exception as e:
2830
print('Failed to delete boards. Reason: %s' % (path, e))
2931

32+
3033
def install_board(file):
31-
dest = target_dir / ("OpenShock-" + file + ".json")
32-
print(" Installing: %s" % dest)
33-
shutil.copyfile(source_dir / file / "board.json", dest)
34+
dest = target_dir / ('OpenShock-' + file + '.json')
35+
print(' Installing: %s' % dest)
36+
shutil.copyfile(source_dir / file / 'board.json', dest)
37+
3438

3539
def install_boards():
36-
print("Installing defined boards")
40+
print('Installing defined boards')
3741
for filename in os.listdir(source_dir):
38-
if os.path.exists(source_dir / filename / "board.json"):
42+
if os.path.exists(source_dir / filename / 'board.json'):
3943
install_board(filename)
4044

45+
4146
create_boards_dir()
4247
wipe_installed_boards()
4348
install_boards()

platformio.ini

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ lib_deps =
2424
board_build.partitions = huge_app.csv ; Overridden per board
2525
board_build.filesystem = littlefs
2626
extra_scripts =
27-
pre:release_or_develop.py
28-
pre:embed_version.py
29-
post:build_frontend.py
27+
pre:scripts/embed_env_vars.py
28+
post:scripts/build_frontend.py
3029

3130
; Serial Monitor options
3231
upload_speed = 921600

release_or_develop.py

-38
This file was deleted.

scripts/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/__pycache__

0 commit comments

Comments
 (0)