Skip to content

Commit

Permalink
feat: add --data-dir option
Browse files Browse the repository at this point in the history
  • Loading branch information
yankeguo committed Jan 22, 2024
1 parent b48fb67 commit 1d1b190
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# bunker
simple bastion system for linux hosts

A simple bastion system for linux hosts

## Installation

### From Binary

Visit [GitHub Releases](https://github.com/yankeguo/bunker/releases) and download the latest release.

Static assets are embedded in the binary, so you don't need to download anything else.

- Prepare a `data` directory and put `bunker.yaml` configuration file in it
- Run `bunker -data-dir data`

### From Container Image

Visit [DockerHub Repository](https://hub.docker.com/repository/docker/yankeguo/bunker) or [GitHub Packages](https://github.com/yankeguo?tab=packages&repo_name=bunker) for container images

- Prepare a `data` directory and put `bunker.yaml` configuration file in it
- Run contaienr image with `/data` mounted, `docker run -p 8080:8080 -p 8022:8022 -v $PWD/data:/data yankeguo/bunker:latest`

## Configuration File

```yaml
server:
listen: ":8080"
ssh_server:
listen: ":8022"
```
## Credits
GUO YANKE, MIT License
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package main

import (
"flag"
"io/fs"
"log"
"net/http"
"os"
"path"
"path/filepath"

"github.com/yankeguo/rg"
"github.com/yankeguo/ufx"
Expand All @@ -18,8 +20,13 @@ func installStatic(ur ufx.Router) {
}

func main() {
var optDataDir string

flag.StringVar(&optDataDir, "data-dir", "", "data directory")
flag.Parse()

app := fx.New(
ufx.ProvideConfFromYAMLFile("bunker.yaml"),
ufx.ProvideConfFromYAMLFile(filepath.Join(optDataDir, "bunker.yaml")),
ufx.Module,
fx.Invoke(installStatic),
)
Expand Down

0 comments on commit 1d1b190

Please sign in to comment.