Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
Signed-off-by: Eray Ates <[email protected]>
  • Loading branch information
rytsh committed Aug 19, 2024
1 parent 1d88007 commit 7cb6112
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 worldline-go
Copyright (c) 2023 rakunlabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you need any feature, find a bug or fixing something send pull request or ope

```sh
docker run -d --name postgres -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres:14.5-alpine
docker run -it --rm --name chore -p 8080:8080 -e STORE_HOST=172.17.0.1 -e STORE_SCHEMA=public ghcr.io/worldline-go/chore:latest
docker run -it --rm --name chore -p 8080:8080 -e STORE_HOST=172.17.0.1 -e STORE_SCHEMA=public ghcr.io/rakunlabs/chore:latest
```

Open browser and go to http://localhost:8080
Expand Down Expand Up @@ -204,13 +204,13 @@ Change `-h` (help) parameter to any arguments of the shell script.

```sh
export TOKEN=""
curl -fksSL https://raw.githubusercontent.com/worldline-go/chore/main/data/record.sh | bash -s -- -h
curl -fksSL https://raw.githubusercontent.com/rakunlabs/chore/main/data/record.sh | bash -s -- -h
```

Or first download it and after run.

```sh
curl -O -fksSL https://raw.githubusercontent.com/worldline-go/chore/main/data/record.sh && chmod +x record.sh
curl -O -fksSL https://raw.githubusercontent.com/rakunlabs/chore/main/data/record.sh && chmod +x record.sh
```

Example arguments
Expand Down
2 changes: 1 addition & 1 deletion _example/swarm/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
# - "5432:5432"

chore:
image: ghcr.io/worldline-go/chore:latest
image: ghcr.io/rakunlabs/chore:latest
environment:
LOGLEVEL: info
SECRET: thisissupersecretjustforthisapp
Expand Down
2 changes: 1 addition & 1 deletion _web/src/components/pages/Users.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
<input
type="email"
name="email"
placeholder="user@worldline.com"
placeholder="user@example.com"
bind:value={edit.email}
class="flex-grow px-2 border border-gray-300 focus:border-red-300 focus:outline-none focus:ring focus:ring-red-200 focus:ring-opacity-50 disabled:bg-gray-100"
/>
Expand Down
15 changes: 10 additions & 5 deletions cmd/chore/args/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ type overrideHold struct {
Value string
}

type ctxValue string

const ctxKeyWg ctxValue = "wg"

var rootCmd = &cobra.Command{
Use: "chore",
Short: "control flow runner",
Long: config.Banner("request with templates"),
Version: config.AppVersion,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
if err := logz.SetLogLevel(config.Application.LogLevel); err != nil {
return err //nolint:wrapcheck // no need
}
Expand All @@ -43,7 +47,7 @@ var rootCmd = &cobra.Command{
},
SilenceUsage: true,
SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, _ []string) error {
// load configuration
if err := loadConfig(cmd.Context(), cmd.Flags().Visit); err != nil {
return err
Expand All @@ -58,11 +62,12 @@ var rootCmd = &cobra.Command{
}

func Execute(ctx context.Context, wg *sync.WaitGroup) error {
ctx = context.WithValue(ctx, "wg", wg)
ctx = context.WithValue(ctx, ctxKeyWg, wg)

return rootCmd.ExecuteContext(ctx) //nolint:wrapcheck // no need
}

//nolint:gochecknoinits
//nolint:gochecknoinits // cobra init
func init() {
rootCmd.Flags().StringVarP(&config.Application.Host, "host", "H", config.Application.Host, "Host to listen on")
rootCmd.Flags().StringVarP(&config.Application.Port, "port", "P", config.Application.Port, "Port to listen on")
Expand Down Expand Up @@ -124,7 +129,7 @@ func loadConfig(ctx context.Context, visit func(fn func(*pflag.Flag))) error {
}

func runRoot(ctx context.Context) error {
wg, _ := ctx.Value("wg").(*sync.WaitGroup)
wg, _ := ctx.Value(ctxKeyWg).(*sync.WaitGroup)
if wg == nil {
return fmt.Errorf("wg not found in context")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type UserRequest struct {

type UserData struct {
Name string `json:"name" gorm:"unique;uniqueIndex;not null" example:"userX"`
Email string `json:"email" example:"userx@worldline.com"`
Email string `json:"email" example:"userx@example.com"`
apimodels.Groups
}

Expand Down

0 comments on commit 7cb6112

Please sign in to comment.