-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add CLI and HTTP server scaffolding #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alanshaw
merged 8 commits into
ash/feat/upload-service-client
from
ash/feat/cli-and-http-server-scaffolding
Jul 2, 2026
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6845380
feat: add CLI and HTTP server scaffolding
alanshaw 778dd36
fix: remove overridden option
alanshaw 0b91a34
chore: apply suggestions from code review
alanshaw 7f44fce
feat: tweak names
alanshaw 168f4f2
refactor: better HTTP server start
alanshaw 7a77962
fix: add import
alanshaw 19a545a
fix: remove redundant timeout
alanshaw 70eb655
feat: add tenant and access key API stubs (#5) (#6) (#8) (#9) (#10) (…
alanshaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 @@ | ||
| hilt |
This file contains hidden or 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,17 @@ | ||
| BINARY := hilt | ||
| BIN_DIR := . | ||
| CMD := ./cmd | ||
|
|
||
| .PHONY: build test vet clean | ||
|
|
||
| build: | ||
| go build -o $(BIN_DIR)/$(BINARY) $(CMD) | ||
|
|
||
| test: | ||
| go test ./... | ||
|
|
||
| vet: | ||
| go vet ./... | ||
|
|
||
| clean: | ||
| rm $(BIN_DIR)/$(BINARY) |
This file contains hidden or 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,58 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
|
|
||
| "github.com/spf13/cobra" | ||
| "go.uber.org/fx" | ||
| "go.uber.org/fx/fxevent" | ||
| "go.uber.org/zap" | ||
|
|
||
| "github.com/fil-forge/hilt/pkg/config" | ||
| appfx "github.com/fil-forge/hilt/pkg/fx" | ||
| ) | ||
|
|
||
| var cfgFile string | ||
|
|
||
| func main() { | ||
| rootCmd := &cobra.Command{ | ||
| Use: "hilt", | ||
| Short: "Hilt tenant management service", | ||
| Long: "Hilt manages tenants of Ingot and their secret keys.", | ||
| } | ||
|
|
||
| serveCmd := &cobra.Command{ | ||
| Use: "serve", | ||
| Short: "Start the hilt service", | ||
| RunE: runServe, | ||
| } | ||
| serveCmd.Flags().String("host", "127.0.0.1", "host to bind the server to") | ||
| serveCmd.Flags().Int("port", 8080, "port to bind the server to") | ||
|
|
||
| rootCmd.AddCommand(serveCmd) | ||
|
|
||
| rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file path (default: looks for config.yaml in current dir)") | ||
|
|
||
| if err := rootCmd.Execute(); err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| func runServe(cmd *cobra.Command, args []string) error { | ||
| cfg, err := config.Load(cfgFile, config.WithFlagSet(cmd.Flags())) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| app := fx.New( | ||
| appfx.AppModule(cfg), | ||
| // Suppress fx's default logging and use our own zap logger. | ||
| fx.WithLogger(func(log *zap.Logger) fxevent.Logger { | ||
| return &fxevent.ZapLogger{Logger: log} | ||
| }), | ||
| ) | ||
| app.Run() | ||
|
|
||
| return nil | ||
| } | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.