Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ before:
builds:
- &build_default
id: server
main: ./cmd
main: ./cmd/server
binary: toxiproxy-server-{{.Os}}-{{.Arch}}
no_unique_dist_dir: true
env:
Expand Down Expand Up @@ -39,7 +39,7 @@ builds:

- <<: *build_default
id: client
main: ./cli
main: ./cmd/cli
binary: toxiproxy-cli-{{.Os}}-{{.Arch}}


Expand All @@ -51,7 +51,7 @@ builds:
- <<: *build_default
id: pkg-client
no_unique_dist_dir: false
main: ./cli
main: ./cmd/cli
binary: toxiproxy-cli

checksum:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# [Unreleased]

* Store all the executable `main` packages in `cmd` folder. (#335, @miry)

# [2.2.0]

* Update linux packages to use `/usr/bin` folder as binary destination and change the executable names to
Expand Down
15 changes: 9 additions & 6 deletions CREATING_TOXICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,22 @@ This is used instead of just a plain `byte[]` so that toxics like latency can fi
how long a chunk of data has been waiting in the proxy.

Toxics are registered in an `init()` function so that they can be used by the server:

```go
func init() {
toxics.Register("toxic_name", new(ExampleToxic))
}
```

In order to use your own toxics, you will need to compile your own binary. This can be
done by copying [toxiproxy.go](https://github.com/Shopify/toxiproxy/blob/master/cmd/toxiproxy.go)
into a new project and registering your toxic with the server. This will allow you to add toxics
without having to make a full fork of the project. If you think your toxics will be useful
to others, contribute them back with a Pull Request.
In order to use your own toxics, you will need to compile your own binary.
This can be done by copying [server
](https://github.com/Shopify/toxiproxy/blob/master/cmd/server/server.go)
into a new project and registering your toxic with the server.
This will allow you to add toxics without having to make a full fork of the project.
If you think your toxics will be useful to others,
contribute them back with a Pull Request.

An example project for building a separate binary can be found here:
An example project for building a separate binary can be found here:
https://github.com/xthexder/toxic-example

## A basic toxic
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ e2e: build

.PHONY: build
build: dist clean
go build -ldflags="-s -w" -o ./dist/toxiproxy-server ./cmd
go build -ldflags="-s -w" -o ./dist/toxiproxy-cli ./cli
go build -ldflags="-s -w" -o ./dist/toxiproxy-server ./cmd/server
go build -ldflags="-s -w" -o ./dist/toxiproxy-cli ./cmd/cli

.PHONY: release
release:
Expand Down
File renamed without changes.
File renamed without changes.