Skip to content
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

Merged
merged 11 commits into from
Dec 19, 2024

Conversation

RabbITCybErSeC
Copy link
Collaborator

No description provided.

@RabbITCybErSeC RabbITCybErSeC linked an issue Dec 10, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Dec 10, 2024

Sigrid maintainability feedback

✅ You wrote maintainable code and achieved your objective of 3.8 stars

Show details

Sigrid compared your code against the baseline of 2024-12-12.

👍 What went well?

You fixed or improved 1 refactoring candidates.

Risk System property Location
🟡 Unit Size
(Improved)
internal/controller/controller.go
Initialize()

👎 What could be better?

Unfortunately, 1 refactoring candidates were introduced or got worse.

Risk System property Location
🟡 Unit Size
(Introduced)
internal/controller/controller.go
run(app *gin.Engine)

📚 Remaining technical debt

5 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid** to explore your technical debt

⭐️ Sigrid ratings

System property System on 2024-12-12 Before changes New/changed code
Volume 5.4 N/A N/A
Duplication 4.4 5.5 5.5
Unit Size 2.6 1.7 1.8
Unit Complexity 2.8 3.6 3.8
Unit Interfacing 2.9 5.5 5.5
Module Coupling 3.8 N/A N/A
Component Independence 0.5 N/A N/A
Component Entanglement 2.5 N/A N/A
Maintainability 3.2 3.8 3.9

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

@RabbITCybErSeC RabbITCybErSeC added this to the SOARCA 1.3 milestone Dec 10, 2024
@MaartendeKruijf MaartendeKruijf marked this pull request as draft December 10, 2024 13:11
@RabbITCybErSeC RabbITCybErSeC marked this pull request as ready for review December 10, 2024 14:14
@RabbITCybErSeC RabbITCybErSeC requested review from MaartendeKruijf and lucamrgs and removed request for MaartendeKruijf December 10, 2024 14:26
Copy link
Collaborator

@MaartendeKruijf MaartendeKruijf left a 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

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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create an int directly ...

Copy link
Collaborator

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

Copy link
Collaborator

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

@RabbITCybErSeC RabbITCybErSeC force-pushed the feature/287-feature-adding-https-tls branch from 78b68d0 to b69c3da Compare December 12, 2024 15:15
@RabbITCybErSeC RabbITCybErSeC force-pushed the feature/287-feature-adding-https-tls branch from 6a5f164 to 376b466 Compare December 19, 2024 13:11
Comment on lines 183 to 194
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)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.RunTLS

return nil
}

func runServer(app *gin.Engine, port string, enableTlS bool, certFile string, keyFile string) error {
Copy link
Collaborator

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

@MaartendeKruijf MaartendeKruijf merged commit d1ada75 into development Dec 19, 2024
10 checks passed
@MaartendeKruijf MaartendeKruijf deleted the feature/287-feature-adding-https-tls branch December 19, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Adding HTTPS/TLS
2 participants