Skip to content

Conversation

@sinadarbouy
Copy link
Collaborator

@sinadarbouy sinadarbouy commented Aug 1, 2024

Ticket(s)

close #583

Description

This PR addresses an issue with the loadEnvVars() function where environment variables were being incorrectly processed due to the strings.ToLower function, which assumed all keys were in lowercase. Configuration blocks, however, use camel case (e.g., activeWrites), causing a mismatch.

  • Implemented Key Conversion:
    • Added a new method, ConvertKeysToLowercase, which converts all keys in the global configuration to lowercase during the loading process, ensuring consistency.
  • Updated Configuration Files:
    • Modified the configuration files (gatewayd.yaml, gatewayd_tls.yaml, missing_keys.yaml) to use lowercase keys (e.g., active-writes instead of writes).
  • Validation Enhancements:
    • Enhanced the ValidateGlobalConfig method to ensure that all keys are lowercase.

Found a bug when errors append into []*gerr.GatewayDError

Previously, the code used a single instance of GatewayDError for all errors. This led to incorrect error messages because the same GatewayDError instance was being modified and appended to the slice, resulting in all errors appearing as if they had the same OriginalError.

Development Checklist

  • I have added a descriptive title to this PR.
  • I have squashed related commits together.
  • I have rebased my branch on top of the latest main branch.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added docstring(s) to my code.
  • I have made corresponding changes to the documentation (docs).
  • I have updated docs using make gen-docs command.
  • I have added tests for my changes.
  • I have signed all the commits.

Legal Checklist

@sinadarbouy
Copy link
Collaborator Author

  • Test cases still left:
    • Test cases for new functions
    • Test cases for environment variable overwrite values in nested maps
@sinadarbouy sinadarbouy changed the title Fix/evc vars expect lower case letters Fix/env vars expect lower case letters Aug 1, 2024
@sinadarbouy sinadarbouy marked this pull request as ready for review August 3, 2024 17:13
@sinadarbouy sinadarbouy force-pushed the fix/evc-vars-expect-lower-case-letters branch from 51705f0 to 1ed011c Compare August 5, 2024 19:35
Signed-off-by: Mostafa Moradian <mstfmoradian@gmail.com>
@mostafa mostafa merged commit bb1889b into gatewayd-io:main Aug 5, 2024
@mostafa mostafa mentioned this pull request Oct 6, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants