Skip to content
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

Support custom app directory location #333

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ On systems with SELinux you may have to run `restorecon /path/to/puma-dev` in or

Simply symlink your app's directory into `~/.puma-dev`! That's it!

You can use the built-in helper subcommand: `puma-dev link [-n name] [dir]` to link app directories into your puma-dev directory (`~/.puma-dev` by default).
You can use the built-in helper subcommand: `puma-dev link [-n name] [dir]` to link app directories into your puma-dev directory (`~/.puma-dev` by default, but can be changed with `PUMA_DEV_APP_DIR`).

### Options

Expand Down Expand Up @@ -352,4 +352,3 @@ To build puma-dev, follow these steps:
Tagged builds (e.g `v0.18.0`) will automatically create [pre-release](https://github.com/puma/puma-dev/releases) with artifacts for use in the Homebrew formula.

All [builds with passing tests](https://github.com/puma/puma-dev/actions) will publish binaries that are saved for 90 days.

2 changes: 1 addition & 1 deletion cmd/puma-dev/main_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
fDNSPort = flag.Int("dns-port", 9253, "port to listen on dns for")
fHTTPPort = flag.Int("http-port", 9280, "port to listen on http for")
fTLSPort = flag.Int("https-port", 9283, "port to listen on https for")
fDir = flag.String("dir", "~/.puma-dev", "directory to watch for apps")
fDir = flag.String("dir", dev.GetEnv("PUMA_DEV_APP_DIR", "~/.puma-dev"), "directory to watch for apps")
fTimeout = flag.Duration("timeout", 15*60*time.Second, "how long to let an app idle for")
fPow = flag.Bool("pow", false, "Mimic pow's settings")
fLaunch = flag.Bool("launchd", false, "Use socket from launchd")
Expand Down
2 changes: 1 addition & 1 deletion cmd/puma-dev/main_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

var (
fDebug = flag.Bool("debug", false, "enable debug output")
fDir = flag.String("dir", "~/.puma-dev", "directory to watch for apps")
fDir = flag.String("dir", dev.GetEnv("PUMA_DEV_APP_DIR", "~/.puma-dev"), "directory to watch for apps")
fDomains = flag.String("d", "test", "domains to handle, separate with :, defaults to test")
fHTTPPort = flag.Int("http-port", 9280, "port to listen on http for")
fNoServePublicPaths = flag.String("no-serve-public-paths", "", "Disable static file server for specific paths under /public")
Expand Down
8 changes: 8 additions & 0 deletions dev/get_env.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package dev

func GetEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}