-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feature Adding TLS-HTTPS configuration #288
Feature Adding TLS-HTTPS configuration #288
Conversation
Sigrid maintainability feedback✅ You wrote maintainable code and achieved your objective of 3.8 stars Show detailsSigrid compared your code against the baseline of 2024-12-12. 👍 What went well?
👎 What could be better?
📚 Remaining technical debt
View this system in Sigrid** to explore your technical debt ⭐️ Sigrid ratings
💬 Did you find this feedback helpful?We would like to know your thoughts to make Sigrid better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure we can setup the certs with docker compose to generate them
internal/controller/controller.go
Outdated
certFile := utils.GetEnv("CERT_FILE", "/certs/server.crt") | ||
certKey := utils.GetEnv("CERT_KEY", "/certs/server.key") | ||
enableFins := utils.GetEnv("ENABLE_FINS", "false") | ||
maxExecutionsStr := utils.GetEnv("MAX_EXECUTIONS", strconv.Itoa(defaultCacheSize)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create an int directly ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move the refactor to an other branch
docker-compose.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minimal config in here
78b68d0
to
b69c3da
Compare
6a5f164
to
376b466
Compare
internal/controller/controller.go
Outdated
enableTLS, _ := strconv.ParseBool(utils.GetEnv("ENABLE_TLS", "false")) | ||
certFile := utils.GetEnv("CERT_FILE", "./certs/server.crt") | ||
keyFile := utils.GetEnv("CERT_KEY_FILE", "./certs/server.key") | ||
|
||
if enableTLS { | ||
if certFile == "" || keyFile == "" { | ||
err := fmt.Errorf("TLS enabled but certificate or key file not provided") | ||
log.Error(err) | ||
return err | ||
} | ||
} | ||
err = runServer(app, port, enableTLS, certFile, keyFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to separate function
@@ -178,7 +180,18 @@ func Initialize() error { | |||
} | |||
|
|||
port := utils.GetEnv("PORT", "8080") | |||
err = app.Run(":" + port) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app.RunTLS
internal/controller/controller.go
Outdated
return nil | ||
} | ||
|
||
func runServer(app *gin.Engine, port string, enableTlS bool, certFile string, keyFile string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Limit to app and enableTLS
No description provided.