LaunchDarkly Feature Flag Implementation

Objective:
The implementation of LaunchDarkly Feature Flags is designed to enable efficient feature management within our applications. In the event of an application malfunction, we can quickly enable the feature flag to disable the problematic feature, preventing user access and ensuring a seamless experience.

Context:
The proof of concept for the LaunchDarkly Feature Flag has been successfully completed. A mechanism has been established to disable both the seller and buyer applications during maintenance periods or unexpected downtime. This functionality ensures that specific sellers or buyers are unable to log into the application during such scenarios.

Scope:
This scope of work encompasses the following use cases:

Seller Application Disabled: By implementing a feature flag to disable login and registration functionalities, sellers will not be able to access the application to create, publish auctions, or utilize other related features.

Buyer Application Disabled: Utilization of a feature flag will restrict login and registration for buyers, preventing their access to the application and participation in auctions.

Specific Buyer and Seller Restrictions: The LaunchDarkly flag allows for access restrictions targeted at specific buyers or sellers. If these individuals are already logged in, the system will automatically log them out.

Specific Auction Management: The ability to disable a particular auction can be achieved by entering the auction ID within the LaunchDarkly platform.

Expected Outcome:
The LaunchDarkly platform is implemented to effectively manage the application during outages or emergencies. This facilitates rapid updates via feature flags, ensuring a swift and efficient response to any issues.

Success Criteria:
Success will be measured by the admin’s ability to utilize the LaunchDarkly platform to manage application features effectively. When a feature is disabled, access to the entire application may be restricted, or access can be limited to specific buyers or sellers. Additionally, specific auctions may also be disabled for content updates.

Risks & Mitigations:
There are potential risks associated with applying a feature flag for specific buyers, sellers, and auctions. For instance, activating a flag for a single user could inadvertently disable access for all users. To mitigate this risk, it is essential to use the LaunchDarkly client to pass the appropriate context and assess the flag value, thereby determining the proper disabling process.

Dependencies:
The successful implementation of the LaunchDarkly Feature Flags relies on the LaunchDarkly SDK, which is based on the configurations of client-side, server-side, and mobile SDKs.

Documentation and References:
SDKs | LaunchDarkly | Documentation
React Web SDK reference | LaunchDarkly | Documentation


Launch Darkly Platform, in which the flags are created

Based on the auction ID disabling the auction, context is created for the particular auction id
Here the kind is used as user and key based on the type if it is email so we have to mention ‘email’.

Feature Management for Specific Sellers:
The following function demonstrates the approach to handle login for a specific seller:
function handleLogin(email_ID) {
return new Promise(async (resolve) => {
const context = {
kind: ‘user’,
key: ‘email’,
email: email_ID,
};

    // Identify the user context for targeted flag evaluation
    await ldClient.identify(context);

    // Wait for initialization to ensure context is fully loaded
    await ldClient.waitForInitialization();

    // Retrieve the flag variation and resolve the promise with the result
    const disableLoginFlag = ldClient.variation('SellerSpecificUser', false);
    setStateLD(disableLoginFlag);
    resolve(disableLoginFlag);  // Explicitly resolve the flag value
});
4 Likes