Commit 06cdbca
committed
refactor: align with project_template_go layout + add only_local app-level upload guard
Convention overhaul:
- deploy/ → example_files/ (template-style; build.sh bundles into release zip)
- example_files/api_show.service systemd unit, template style
(User=root, WorkingDirectory=/api_show,
ExecStart=/api_show/api_show, no EnvironmentFile)
- example_files/install_api_show.sh install/update/uninstall actions,
backup-rename old binary + config with
_YYYY-MM-DD_HH-MM-SS timestamp
- example_files/config_example.yaml yaml schema (secret + upload_token +
data_dir + port + only_local)
- example_files/nginx.conf thin reverse proxy; /upload-allowlist
block removed (now app-side)
- deploy/upgrade.sh dropped (install_api_show.sh `update` action covers it)
- deploy/install.sh dropped (replaced by example_files/install_api_show.sh)
Config-from-yaml refactor:
- ac_config/ac_config.go gains FileConfig + LoadConfig(path) + GlobalConfig.
Reads ./conf/config.yaml relative to WorkingDirectory; missing file is
NOT fatal (defaults populate; env still overrides).
- main.go loads yaml at boot, then env vars override file values.
- Fixed lowercase env var typos: api_show_PORT/SECRET/TOKEN → API_SHOW_*.
App-level LAN guard:
- new config flag `only_local` (default true): /upload checks
r.RemoteAddr against IsPrivate() / IsLoopback() / IsLinkLocalUnicast();
public-IP requesters are 403'd at the app even with valid Bearer.
- X-Forwarded-For deliberately ignored — only_local trusts the kernel
peer IP, not headers (forgery-resistant).
- nginx.conf simplified: no more /upload location block; /upload gating
fully owned by api_show binary.
build.sh:
- bundles example_files/{api_show.service,install_api_show.sh,
config_example.yaml,nginx.conf} into the release zip.
Smoke verified:
- GOWORK=off go build clean
- ./build.sh produces api_show_darwin_release_v0.0.3.zip containing
api_show + install_api_show.sh + api_show.service + conf/config.yaml
+ conf/nginx.conf (7 files, ~12.6MB).
Layout now matches github.com/0xYeah/project_template_go convention.1 parent b51074e commit 06cdbca
11 files changed
Lines changed: 345 additions & 211 deletions
File tree
- ac_config
- deploy
- example_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
8 | 16 | | |
9 | 17 | | |
10 | 18 | | |
11 | 19 | | |
12 | 20 | | |
13 | | - | |
| 21 | + | |
14 | 22 | | |
15 | 23 | | |
16 | 24 | | |
17 | | - | |
| 25 | + | |
| 26 | + | |
18 | 27 | | |
19 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments