feat: refactor config package#2109
Open
nrwiersma wants to merge 2 commits into
Open
Conversation
Ullaakut
approved these changes
Apr 19, 2026
Member
Ullaakut
left a comment
There was a problem hiding this comment.
Nitpicks. So much insane stuff left in those packages though, no idea how much work it would be to bring everything up to standard.
| t.Errorf("Port was incorrect. Got: %s, want: %s", conf.Port, expPort) | ||
| } | ||
| } | ||
| var testFile = filepath.Join("testdata", "config.dev.toml") |
Member
There was a problem hiding this comment.
Why use filepath.Join for this instead of just making this a const defined as testdata/config.dev.toml ?
Comment on lines
+37
to
+44
| // MongoStorage specifies the properties required to use MongoDB as the storage backend. | ||
| type MongoStorage struct { | ||
| URL string `envconfig:"ATHENS_MONGO_STORAGE_URL" validate:"required"` | ||
| DefaultDBName string `default:"athens" envconfig:"ATHENS_MONGO_DEFAULT_DATABASE"` | ||
| DefaultCollectionName string `default:"modules" envconfig:"ATHENS_MONGO_DEFAULT_COLLECTION"` | ||
| CertPath string `envconfig:"ATHENS_MONGO_CERT_PATH"` | ||
| InsecureConn bool `envconfig:"ATHENS_MONGO_INSECURE"` | ||
| } |
Member
There was a problem hiding this comment.
Wouldnt it be more readable to have the defaults second so that the envconfig tags align? Is it because of a linter or smth that they are ordered they way they are now?
Comment on lines
+46
to
+58
| // S3Storage specifies the properties required to use S3 as the storage backend. | ||
| type S3Storage struct { | ||
| Region string `envconfig:"AWS_REGION" validate:"required"` | ||
| Key string `envconfig:"AWS_ACCESS_KEY_ID"` | ||
| Secret string `envconfig:"AWS_SECRET_ACCESS_KEY"` | ||
| Token string `envconfig:"AWS_SESSION_TOKEN"` | ||
| Bucket string `envconfig:"ATHENS_S3_BUCKET_NAME" validate:"required"` | ||
| UseDefaultConfiguration bool `envconfig:"AWS_USE_DEFAULT_CONFIGURATION"` | ||
| ForcePathStyle bool `envconfig:"AWS_FORCE_PATH_STYLE"` | ||
| CredentialsEndpoint string `envconfig:"AWS_CREDENTIALS_ENDPOINT"` | ||
| AwsContainerCredentialsRelativeURI string `envconfig:"AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"` | ||
| Endpoint string `envconfig:"AWS_ENDPOINT"` | ||
| } |
Member
There was a problem hiding this comment.
Sometimes I like tagalign, here I hate it lmao
| Secret: "minio123", | ||
| Bucket: test.name, | ||
| }, config.GetTimeoutDuration(300)) | ||
| }, 300*time.Second) |
Member
There was a problem hiding this comment.
5 * time.Minute seems clearer to me since on a quick read this could look like 30s, but no big deal.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What is the problem I am trying to address?
The
configpackage is inconsistent and difficult to parse. This PR attempts to refactor it to be more consistent and idiomatic.How is the fix applied?
The general sense of the change is:
What GitHub issue(s) does this PR fix or close?