Skip to content

Commit

Permalink
Make the -c flag instead be set as as env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
foodelevator committed Jan 27, 2024
1 parent 55e2d89 commit ab9e1d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ GET /:path
| PORT | The port to listen to requests on |
| TOKEN | GitHub Personal Access Token used for authorization when pulling the content repository |
| CONTENT_URL | The repository to get content from |
| CONTENT_DIR | Directory to serve contents from. Setting this disables the automatic fetching using git and makes the `TOKEN` and `CONTENT_URL` unused. |

### Flags

Expand All @@ -48,11 +49,10 @@ GET /:path
| -v | Print info messages |
| -vv | Print more info messages |
| -w | Reload the contents when they change on disk |
| -c | Directory to serve contents from. Setting this disables the automatic fetching using git and makes the `TOKEN` and `CONTENT_URL` unused. |

## API documentation

http://godoc.org/github.com/datasektionen/taitan
http://godoc.org/github.com/datasektionen/taitan
http://godoc.org/github.com/datasektionen/taitan/parse

## Public domain
Expand Down
6 changes: 2 additions & 4 deletions taitan.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var (
debug bool // Show debug level messages.
info bool // Show info level messages.
watch bool // Watch for file changes.
contentDir string // Serve the `contents` instead of using git to get them from CONTENT_URL
responses Atomic // Our parsed responses.
)

Expand All @@ -38,7 +37,6 @@ func init() {
flag.BoolVar(&debug, "vv", false, "Print debug messages.")
flag.BoolVar(&info, "v", false, "Print info messages.")
flag.BoolVar(&watch, "w", false, "Watch for file changes.")
flag.StringVar(&contentDir, "c", "", "Serve the `contents` instead of using git to get them from CONTENT_URL")
flag.Usage = usage
flag.Parse()
}
Expand All @@ -52,7 +50,7 @@ func getEnv(env string) string {
}

func getRoot() string {
if contentDir != "" {
if contentDir, ok := os.LookupEnv("CONTENT_DIR"); ok {
return contentDir
}
content := getEnv("CONTENT_URL")
Expand All @@ -66,7 +64,7 @@ func getRoot() string {
}

func getContent() {
if contentDir != "" {
if _, ok := os.LookupEnv("CONTENT_DIR"); ok {
return
}
content := getEnv("CONTENT_URL")
Expand Down

0 comments on commit ab9e1d0

Please sign in to comment.