-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update executor contract, publish local dev server
- Loading branch information
Showing
13 changed files
with
330 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
"os" | ||
"path/filepath" | ||
"strconv" | ||
|
||
"github.com/kubeshop/botkube/pkg/loggerx" | ||
"github.com/kubeshop/botkube/pkg/pluginx" | ||
) | ||
|
||
func main() { | ||
pluginsDir := flag.String("plugins-dir", getEnv("PLUGINS_DIR", "plugin-dist"), "Plugins directory") | ||
host := flag.String("host", getEnv("PLUGIN_SERVER_HOST", "http://localhost"), "Local server host") | ||
port := flag.String("port", getEnv("PLUGIN_SERVER_PORT", "3010"), "Local server port") | ||
flag.Parse() | ||
|
||
dir, err := os.Getwd() | ||
loggerx.ExitOnError(err, "while getting current directory") | ||
|
||
portInt, err := strconv.Atoi(*port) | ||
loggerx.ExitOnError(err, "while casting server port value") | ||
|
||
binDir := filepath.Join(dir, *pluginsDir) | ||
indexEndpoint, startServerFn := pluginx.NewStaticPluginServer(pluginx.StaticPluginServerConfig{ | ||
BinariesDirectory: binDir, | ||
Host: *host, | ||
Port: portInt, | ||
}) | ||
|
||
log.Printf("Service plugin binaries from %s\n", binDir) | ||
log.Printf("Botkube repository index URL: %s", indexEndpoint) | ||
err = startServerFn() | ||
loggerx.ExitOnError(err, "while starting server") | ||
} | ||
|
||
func getEnv(key, defaultValue string) string { | ||
value, exists := os.LookupEnv(key) | ||
if !exists { | ||
return defaultValue | ||
} | ||
return value | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.