CLI for inject dynamic values into code/config files from external commands using a declarative YAML config. More about this tool in article: «Devsyringe: Stop Copy-Pasting Dynamic Values»
In many projects, you have parameters like web domains, API tokens, titles, passwords, or UUIDs.
When working in a programming environment, we often use .env files and helper libraries:
load_dotenv(find_dotenv())
host = get_env("HOST")This works well when you have a compiler, package manager, or libraries. But sometimes you need to work with simple HTML files, static configs, or scripts --- where such tools are not available.
Devsyringe solves this problem: it can fetch values from any source and inject them into any target files, making your parameters dynamic without templates.
In this demo we use this compose file:
serums:
https_host:
source: ssh -R 80:localhost:3000 serveo.net
mask: https?://[^\s]*?\.serveo\.net\b
targets:
.env:
path: ./.env
clues: ["HOST"]Devsryinge run command, cut vlue from ouput with mask and replace value in target .env file under the mask to new. Very simple!
- Install with Go:
go install github.com/alchemmist/devsyringe/cmd/dsy@latest- Arch from
AUR:
paru -S devsyringe
# or: yay -S devsyringe- Mac with
brew:
brew tap alchemmist/homebrew-tap
brew install devsyringe-
Commands for preocess cofnig and controll processes, which need to be got injectable values. See table bottom.
-
Use
dsy [command] --helpfor more information about a command. -
Use
dsywithout commands or flags for run TUI with table of processes.- In TUI you can see table of processes, which devsyringe run. In table you can see status of process (
stopedoractive), command for running,PIDand title. - Here you can controll processes with hotkeys. Press
?for see help. You can stop process, delete process, see full ouput of process and so on. Available commands for process config and controll processes:
Command Description completionGenerate the autocompletion script for the specified shell deleteIf not stopped, stop. Then delete process with [title] from list and delete all logs. helpHelp about any command injectStart an injection based on some config listShow dynamic list of running processes logsShow logs from process with [title] stopStop process with [title], but save logs and keep in list - In TUI you can see table of processes, which devsyringe run. In table you can see status of process (
Devsyringe uses a YAML file (usually named devsyringe.yaml) to describe what commands to run,
how to extract values from their output, and where to inject them.
serums:
<title>:
source: <command>
mask: <regex>
max-timeout: <seconds>
targets:
<alias>:
path: <file-path>
clues: [<clue1>, <clue2>, ...]serums — the root section. Each child key under serums defines a serum (a dynamic value you want to manage).
<title> — unique name of the serum (e.g. localtunnel, https_host, ping-test).
| Option | Type | Description | Example |
|---|---|---|---|
source |
string | Command to run. Its output will be scanned to extract values. | lt --port 80 |
mask |
regex | Regular expression to capture the desired part of the output. If omitted, the whole output is used. | https://[a-z0-9\-]+\.loca\.lt |
max-timeout |
int (sec) | Maximum time to wait for source output before failing. |
5 |
targets |
map | Where to inject the extracted value(s). Each target has its own settings. | see below |
Targets: Each serum may inject values into one or multiple files.
targets:
<alias>:
path: <file-path>
clues: [<clue1>, <clue2>, ...]<alias> — arbitrary name for readability (e.g. env, js, config).
path — relative or absolute path to the file to update.
clues — list of words/markers that help Devsyringe find the right place in the file to replace.
Exampel 1 -- Localtunnel URL injection:
serums:
localtunnel:
source: lt --port 80
mask: https://[a-z0-9\-]+\.loca\.lt
targets:
.env:
path: test/.env
clues: ["HOST"]
js:
path: test/static.js
clues: ["const", "url"]Example 2 -- SSH serveo tunnel with timeout:
serums:
https_host:
source: ssh -R 80:localhost:3000 serveo.net
mask: https?://[^\s]*?\.serveo\.net\b
max-timeout: 5
targets:
.env:
path: ./.env
clues: ["HOST"]
js:
path: ./static/scanner.js
clues: ["const", "url"]If you run into any issues or have any suggestions, open a Pull Request that includes the updates and I'll review/comment/merge it as soon as I can. If you don't have enough time or don't know how to fix the issue, submit an Issue and provide as much detail as you can.
For any questions, mail at: anton.ingrish@gmail.com
