Git Product home page Git Product logo

hulak's Introduction

Hulak

hulak's People

Contributors

pthapa1 avatar

Watchers

Pratik Thapa avatar

hulak's Issues

Parsing `.env` files

Work Summary: Parsing .env Files and Variable Setup

The task focuses on enabling the application to read and parse environment variable files (.env), including the ability to manage and switch between different environment contexts (e.g., GLOBAL and collection-specific environments). The goal is to facilitate a flexible and dynamic configuration system that allows users to define variables within .env files and reference these variables within their application, thereby tailoring their API testing environment to specific needs.

Objectives:

  1. Environment File Parsing: Implement functionality to accurately parse .env files, supporting variables without quotes, or with quotes for string values. This includes interpreting lines like PASSWORD=mypassword and USERNAME="randomName" correctly, and handling edge cases such as spaces around the = sign.

  2. Variable Reference Resolution: Develop a mechanism to replace variable references within the application (e.g., {{PASSWORD}}) with their corresponding values from the active environment. This involves scanning input strings for variable patterns and substituting them with the actual values stored in memory.

  3. Environment Context Management: Create a system that allows users to switch between different environment contexts. By default, variables from the GLOBAL environment (env/.env.global) should be accessible, but users should be able to switch to collection-specific environments as needed.

Tasks to Complete:

  1. Parse .env Files:

    • Write a parser that reads .env files line by line, extracting key-value pairs.
    • Ensure the parser can handle both quoted and unquoted values, stripping quotes where necessary.
  2. Store and Manage Environment Variables:

    • Implement a storage mechanism (e.g., a map or dictionary) in memory to hold environment variables.
    • Include functionality to update this storage with variables from parsed .env files.
  3. Implement Variable Reference Resolution:

    • Develop a function to search for {{variableName}} patterns in strings and replace them with the actual variable values from the current active environment.
  4. Environment Switching Capability:

    • Enable command-line arguments or commands within the application for users to switch the active environment context.
    • Ensure that switching contexts updates the set of available environment variables accordingly.
  5. Default to GLOBAL Environment:

    • Set the application to use variables from env/.env.global by default upon startup.
    • Allow for these global variables to be overridden by collection-specific variables when a different environment context is activated.
  6. Testing and Validation:

    • Write unit tests for the .env file parser to cover various edge cases.
    • Test the variable reference resolution feature with different input scenarios.
    • Verify the environment switching functionality works as expected, with proper fallbacks to the GLOBAL environment.
  7. Variable Error Resolution:

    • Throw clear errors if the variable is not found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.