Skip to content

Commit

Permalink
Add -f to be able to change the yaml config path
Browse files Browse the repository at this point in the history
  • Loading branch information
agonzalezro committed Jan 23, 2017
1 parent b531547 commit adf1e37
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ Botella

Bot (for Slack et al) with plugins. What's the selling point then? The plugins are Docker containers and the bot interacts with them via stdin/stdout. In plain English that means that you can develop your plugins in whatever language you want and you will just need to pack them as a Docker container to be able to use them with Botella.

Install
-------

[Grab a release](https://github.com/agonzalezro/botella/releases) & give it executable permissions, for example with `chmod a+x`.

Usage
-----

You just need to be sure that you have a botella.yaml` file in the path where you run it. This file could look like:
You just need to be sure that you have a `botella.yaml` (or in another place if you use `-f`) file in the path where you run it. This file could look like:

```yaml
adapters:
Expand Down
17 changes: 12 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"fmt"
"os"
"os/signal"
Expand Down Expand Up @@ -120,13 +121,19 @@ func listenAndReply(adapters []adapter.Adapter, plugins []*plugin.Plugin) {
}

func main() {
configPath, err := inferConfigPath()
if err != nil {
log.Error(err)
os.Exit(-1)
configPath := flag.String("f", "", "Use a different file for the config. By default: botella.y{,a}ml")
flag.Parse()

if *configPath == "" {
inferedPath, err := inferConfigPath()
if err != nil {
log.Error(err)
os.Exit(-1)
}
configPath = &inferedPath
}

config, err := config.NewFromFile(configPath)
config, err := config.NewFromFile(*configPath)
if err != nil {
log.Error(err)
os.Exit(-1)
Expand Down

0 comments on commit adf1e37

Please sign in to comment.