detached c1bd492

refactor(config): prioritize ENV variable for branch detection and update firewall script

- Update PostBootScripts to use firewalld.sh instead of ufw.sh
- Refactor NewConfig to prioritize ENV=dev environment variable over version-based detection
- Improve code clarity with explicit if/else structure for branch selection
- Add comments explaining precedence rules for environment-based configuration
commit
c1bd4927cb80bc79361e46d9cd592ba970d1d7e2
author
brice · · 2026-01-25 18:00 UTC
parent
d57f4db
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +16 -10
M internal/config/config.go +16 -10
@@ -188,7 +188,7 @@ const (
188188 var PostBootScripts = []string{
189189 "all.sh",
190190 "snapper.sh",
191- "ufw.sh",
191+ "firewalld.sh",
192192 "ssh-keygen.sh",
193193 "archup-cli.sh",
194194 "blesh.sh",
@@ -249,18 +249,24 @@ type Config struct {
249249
250250 // NewConfig creates a new Config with sensible defaults
251251 // version parameter determines which branch to use for downloads (dev builds use dev branch)
252+// ENV=dev environment variable takes precedence over version-based detection
252253 func NewConfig(version string) *Config {
253- // Determine which branch to use based on version
254+ // Determine which branch to use
255+ // ENV=dev takes precedence, then fall back to version-based detection
254256 var branch string
255- switch {
256- case version == "dev" || version == "":
257+ if os.Getenv("ENV") == "dev" {
257258 branch = "dev"
258- case strings.Contains(version, "-dev"):
259- branch = "dev"
260- case strings.Contains(version, "-next"):
261- branch = "dev"
262- default:
263- branch = "main"
259+ } else {
260+ switch {
261+ case version == "dev" || version == "":
262+ branch = "dev"
263+ case strings.Contains(version, "-dev"):
264+ branch = "dev"
265+ case strings.Contains(version, "-next"):
266+ branch = "dev"
267+ default:
268+ branch = "main"
269+ }
264270 }
265271
266272 return &Config{
@@ -188,7 +188,7 @@ const (
188 var PostBootScripts = []string{188 var PostBootScripts = []string{
189 "all.sh",189 "all.sh",
190 "snapper.sh",190 "snapper.sh",
191- "ufw.sh",191+ "firewalld.sh",
192 "ssh-keygen.sh",192 "ssh-keygen.sh",
193 "archup-cli.sh",193 "archup-cli.sh",
194 "blesh.sh",194 "blesh.sh",
@@ -249,18 +249,24 @@ type Config struct {
249 249
250 // NewConfig creates a new Config with sensible defaults250 // NewConfig creates a new Config with sensible defaults
251 // version parameter determines which branch to use for downloads (dev builds use dev branch)251 // version parameter determines which branch to use for downloads (dev builds use dev branch)
252+// ENV=dev environment variable takes precedence over version-based detection
252 func NewConfig(version string) *Config {253 func NewConfig(version string) *Config {
253- // Determine which branch to use based on version254+ // Determine which branch to use
255+ // ENV=dev takes precedence, then fall back to version-based detection
254 var branch string256 var branch string
255- switch {257+ if os.Getenv("ENV") == "dev" {
256- case version == "dev" || version == "":
257 branch = "dev"258 branch = "dev"
258- case strings.Contains(version, "-dev"):259+ } else {
259- branch = "dev"260+ switch {
260- case strings.Contains(version, "-next"):261+ case version == "dev" || version == "":
261- branch = "dev"262+ branch = "dev"
262- default:263+ case strings.Contains(version, "-dev"):
263- branch = "main"264+ branch = "dev"
265+ case strings.Contains(version, "-next"):
266+ branch = "dev"
267+ default:
268+ branch = "main"
269+ }
264 }270 }
265 271
266 return &Config{272 return &Config{

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close