opentorc / config-wrapper

Wrapper module for managing app configurations w/ AWS param store
MIT License
1 stars 2 forks source link

storing config in dynamodb table poc #12

Open danieljse opened 1 year ago

danieljse commented 1 year ago

https://github.com/opentorc/torc-serverless/issues/557

This PR is a POC for storing config parameters in Config table - related PR https://github.com/opentorc/platform-api/pull/1133 - added two methods to the cli to be able to test it.

  1. Create Config table mentioned in the related PR 1.a Creat SSM variable DYNAMODB_CONFIG_TABLE under common path

  2. install config-wrapper package locally npm i path../.../config-wrapper

  3. create sharedConfig.json eg

    {
    "DYNAMODB_USER_TABLE_STREAM": {
        "value": "TABLE_NAME"
    },
    "ASSESSMENT_CONFIG": {
       "value":  {
                "testId": 123459,
                "valir": false
       }
    },
    "ARRAY_CONFIG" : {
      "value": [{
        "testValue" : 5
      }]
    }
    }
    1. with the cli create service parameters config-wrapper putSharedConfigFromFile --infile sharedConfig.json --env develop --service resolvers

    2. with the cli get service parameters config-wrapper getSharedConfigByService --env develop --service resolvers

    —-

NOTE: When configWrapper.awsManager.getSharedConfigByService() method is called in a lambda function. Lambda function should have dynamodb:Query permission for the Config_Table including Config_Table/index/*

callmekatootie commented 1 year ago

Great work on this btw!