Skip to content

Commit

Permalink
refactor: Remove .env file
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed Apr 26, 2024
1 parent 5f9b9fe commit bd529e7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 55 deletions.
9 changes: 0 additions & 9 deletions .env

This file was deleted.

12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

# build dirs
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test
build
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ all:
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o build/coap-cli-linux cmd/main.go
CGO_ENABLED=0 GOOS=darwin go build -ldflags "-s -w" -o build/coap-cli-darwin cmd/main.go
CGO_ENABLED=0 GOOS=windows go build -ldflags "-s -w" -o build/coap-cli-windows cmd/main.go

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ When running, please provide following format:
| d | data to be sent in POST or PUT | "" |
| cf | content format | 50 (JSON format) |

The default values are as set in the [.env](.env) file. Modify them as required.

## Examples:

```bash
Expand Down
15 changes: 5 additions & 10 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"
"syscall"

cli "github.com/mainflux/coap-cli"
coap "github.com/mainflux/coap-cli/coap"
coapmsg "github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/go-coap/v3/message/codes"
Expand All @@ -36,10 +35,6 @@ func printMsg(m *pool.Message) {
}

func main() {
config, err := cli.LoadConfig()
if err != nil {
log.Fatalf("Error loading config: %v", err)
}

var rootCmd = &cobra.Command{
Use: "coap-cli <method> <URL> [options]",
Expand All @@ -56,7 +51,7 @@ func main() {
return
},
}
getCmd.Flags().BoolVarP(&observe, "observe", "o", config.Observe, "Observe resource")
getCmd.Flags().BoolVarP(&observe, "observe", "o", false, "Observe resource")
getCmd.Example = `coap-cli get channels/0bb5ba61-a66e-4972-bab6-26f19962678f/messages/subtopic -a 1e1017e6-dee7-45b4-8a13-00e6afeb66eb \n
coap-cli get channels/0bb5ba61-a66e-4972-bab6-26f19962678f/messages/subtopic --auth 1e1017e6-dee7-45b4-8a13-00e6afeb66eb -o `

Expand Down Expand Up @@ -98,10 +93,10 @@ func main() {
deleteCmd.Flags().StringVarP(&data, "data", "d", "", "Data")

rootCmd.AddCommand(getCmd, putCmd, postCmd, deleteCmd)
rootCmd.PersistentFlags().StringVarP(&host, "host", "H", config.Host, "Host")
rootCmd.PersistentFlags().StringVarP(&port, "port", "p", config.Port, "Port")
rootCmd.PersistentFlags().StringVarP(&auth, "auth", "a", config.Auth, "Auth")
rootCmd.PersistentFlags().IntVarP(&contentFormat, "content-format", "c", config.ContentFormat, "Content format")
rootCmd.PersistentFlags().StringVarP(&host, "host", "H", "localhost", "Host")
rootCmd.PersistentFlags().StringVarP(&port, "port", "p", "5683", "Port")
rootCmd.PersistentFlags().StringVarP(&auth, "auth", "a", "", "Auth")
rootCmd.PersistentFlags().IntVarP(&contentFormat, "content-format", "c", 50, "Content format")

if err := rootCmd.Execute(); err != nil {
log.Fatalf("Error executing command: %v", err)
Expand Down
26 changes: 0 additions & 26 deletions configs.go

This file was deleted.

2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ require (
)

require (
github.com/caarlos0/env/v10 v10.0.0
github.com/dsnet/golib/memfile v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/joho/godotenv v1.5.1
github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/transport/v3 v3.0.1 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/caarlos0/env/v10 v10.0.0 h1:yIHUBZGsyqCnpTkbjk8asUlx6RFhhEs+h7TOBdgdzXA=
github.com/caarlos0/env/v10 v10.0.0/go.mod h1:ZfulV76NvVPw3tm591U4SwL3Xx9ldzBP9aGxzeN7G18=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -13,8 +11,6 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8 h1:r7K+oQUYubeA0am08kTAvd2wT2D8PZggs/CpMGp0nkM=
github.com/pion/dtls/v2 v2.2.8-0.20240201071732-2597464081c8/go.mod h1:/gft3czh67pwl4nM1BBUvF7eTy72uGkObJXOYfxRDbA=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
Expand Down

0 comments on commit bd529e7

Please sign in to comment.