Skip to content

Commit c0a013c

Browse files
committed
feat(config): add post-install script for Scoop and set default BaseURL in config
1 parent 85e4b70 commit c0a013c

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

.goreleaser.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ scoops:
128128
homepage: https://github.com/dployr-io/scoop-dployr
129129
description: "Ship apps, not infrastructure!"
130130
license: Apache License, Version 2.0
131+
post_install:
132+
- "$config_dir = \"$env:ProgramData\\dployr\""
133+
- "$config_file = \"$config_dir\\config.toml\""
134+
- "if (-not (Test-Path $config_dir)) { New-Item -ItemType Directory -Path $config_dir | Out-Null }"
135+
- "if (-not (Test-Path $config_file)) { Set-Content -Path $config_file -Value 'base_url = \"https://base.dployr.io\"' }"
131136

132137
release:
133138
github:

internal/cli/config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ func Load() (*Config, error) {
4747
if _, err := toml.DecodeFile(Path(), &cfg); err != nil && !os.IsNotExist(err) {
4848
return nil, fmt.Errorf("could not read config: %w", err)
4949
}
50+
if cfg.BaseURL == "" {
51+
cfg.BaseURL = "https://base.dployr.io"
52+
}
5053
return &cfg, nil
5154
}
5255

0 commit comments

Comments
 (0)