1.0.5 ā€¢ Published 2 years ago

@turnkeyid/configurator-sdk v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Welcome to TurnkeyID Configurator SDK! šŸ’Œ šŸ‘‹

License: MIT Author: @fatihaziz Community: TurnkeyID Devs

Ready to use vault config loader with session

Goal

  • Services can have centralized config, but local config still has control over
  • Ability to fail-over and prioritize sources : (SESSION(Non-Expired) -> VAULT -> LOCAL -> SESSION)

How to use

  1. Install this package
    npm install --save @turnkeyid/configurator-sdk
    # or
    yarn add @turnkeyid/configurator-sdk
  2. Create your own logger function:
       // ./configs/my_service_config.ts
       export const MyServiceConfigurator = ConfiguratorSDK.create<MyServiceConfig>({
          configuratorAppRootDir: process.cwd(),  // *required, where root dir of the program lies
          configMapper: config => config,
          configName: 'MY_SERVICE_CONFIGURATOR',
          configPath: 'my_service_config',
          configuratorSettingOverride: {
             sessionStorageDir: "sessions", // path / dir relative to configuratorAppRootDir!
             localRootDir: "local_configs", // path / dir relative to configuratorAppRootDir!
          },
        })
  3. Import it anywhere:

       // ./index.ts
       import { MyServiceConfigurator } from './configs/my_service_config.ts'
    
       // remember you need to wrap await with async function
       // get all configs
       const configs = await MyServiceConfigurator.get()
       // result : MyServiceConfig[]
    
       // get by config id
       const configId1 = await MyServiceConfigurator.getByID(1) 
       // result : MyServiceConfig | undefined

Change Logs

  • v1.0.3:
    • Fixes:
      • Fix sessionHistory setting don't work
      • Fix history files pilled up uncontrollable.
  • v1.0.2:
    • Introduce README
    • BREAKING change, ConfiguratorSettingsType -> ConfiguratorSetting
    • BREAKING change, configuratorAppRootDir is required on create configurator!
    • Ability to save session version history, sessionHistory (default: true)
    • Ability to set priority config source VAULT or LOCAL (default: VAULT)
    • Performance improvement
  • v1.0.1:
    • Project initialized

Author

šŸ‘·ā€ā™€ļø TurnkeyID Developers - Fatihaziz

Question

developer@turnkey.id

fatih@turnkey.id

Show your support

Give a ā­ļø if this project helped you!