-
-
Notifications
You must be signed in to change notification settings - Fork 13.3k
tronbyt-server 2.0.0 handle existing config files #259725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| EOS | ||
| (var/"tronbyt-server").mkpath | ||
| dot_env = var/"tronbyt-server/.env" | ||
| unless dot_env.exist? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wont work as install block is used to build bottles. Such logic should be in post_install block
And I'm not sure if this check is needed at all:
$ brew install tronbyt-server
...
$ cat /opt/homebrew/var/tronbyt-server/.env
# Add application configuration here.
# For example:
# LOG_LEVEL=INFO
$ echo "# Foo bar baz" >> /opt/homebrew/var/tronbyt-server/.env
$ cat /opt/homebrew/var/tronbyt-server/.env
# Add application configuration here.
# For example:
# LOG_LEVEL=INFO
# Foo bar baz
$ brew reinstall tronbyt-server
...
$ cat /opt/homebrew/var/tronbyt-server/.env
# Add application configuration here.
# For example:
# LOG_LEVEL=INFO
# Foo bar baz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was testing with --head:
❯ brew install --head tronbyt-server
==> Fetching downloads for: tronbyt-server
✔︎ API Source tronbyt-server.rb [Verified 2.7KB/ 2.7KB]
✔︎ Formula tronbyt-server (HEAD-63fa65a)
==> go build -ldflags=-s -w -X tronbyt-server/internal/version.Version=HEAD-63fa65a -X tronbyt-server/internal/version.Commit=63fa65a -X tronbyt-server/internal/version.BuildDate=2025-12-22T13:08:47Z
Error: An exception occurred within a child process:
RuntimeError: Will not overwrite /opt/homebrew/var/tronbyt-server/.env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving the part to post_install helped:
❯ HOMEBREW_NO_INSTALL_FROM_API=1 brew reinstall tronbyt-server
==> Fetching downloads for: tronbyt-server
✔︎ Formula tronbyt-server (HEAD-63fa65a)
==> Reinstalling tronbyt-server
==> go build -ldflags=-s -w -X tronbyt-server/internal/version.Version=HEAD-63fa65a -X tronbyt-server/internal/version.Commit=63fa65a -X tronbyt-server/internal/version.BuildDate=2025-12-22T13:08:47Z
==> Caveats
Application configuration should be placed in:
/opt/homebrew/var/tronbyt-server/.env
To start tronbyt-server now and restart at login:
brew services start tronbyt-server
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/tronbyt-server/bin/tronbyt-server
==> Summary
🍺 /opt/homebrew/Cellar/tronbyt-server/HEAD-63fa65a: 9 files, 43.9MB, built in 4 seconds
==> Running `brew cleanup tronbyt-server`...
❯ cat /opt/homebrew/var/tronbyt-server/.env
# Add application configuration here.
# For example:
LOG_LEVEL=DEBUG
14e105b to
387ce4f
Compare
Quick follow up on Homebrew#259630: only create the .env file if it doesn't exist to avoid this error on upgrades: ``` Error: An exception occurred within a child process: RuntimeError: Will not overwrite /opt/homebrew/var/tronbyt-server/.env ```
387ce4f to
291ed06
Compare
Quick follow up on
#259630: only create the .env file if it doesn't exist to avoid this error on upgrades:
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where<formula>is the name of the formula you're submitting?brew test <formula>, where<formula>is the name of the formula you're submitting?brew audit --strict <formula>(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it passbrew audit --new <formula>?