Giter Site home page Giter Site logo

Comments (11)

ivarconr avatar ivarconr commented on July 19, 2024 1

Hi, setting environment in the SDK is not longer necessary as the environment is encoded in to the SDK token.

It still exists for backward compatibility for enterprise customers.

@thomasheartman we should update all our SDK how-to guides to reflect this.

from unleash-client-go.

wilberto-montoya-vertiv avatar wilberto-montoya-vertiv commented on July 19, 2024

Thank you for the quick answer ivarconr, I understand better now, still, I am using an admin API token (need to do some admin task like create new features), as far I can see in the UI only client tokens can specify the environment. Is this a UI limitation that will be expanded in the future or do Admin tokens cannot specify the environment by definition and do I need to use client tokens instead?

from unleash-client-go.

stale avatar stale commented on July 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from unleash-client-go.

thomasheartman avatar thomasheartman commented on July 19, 2024

Hey, @wilberto-montoya-vertiv! Sorry, I realize this completely slipped for us πŸ™‡πŸΌ Did you ever figure things out? If not, here's a little info that might help you out:

Using admin tokens with clients is not well supported. It will work, but only to some extent. There's more info on the difference between admin and client tokens in API tokens and client tokens doc that we put up a while ago.

More specifically in your case:

When using a client SDK, you specify the environment via the API token. Client SDKs with admin tokens can only get toggles from the default environment.

I am using an admin API token (need to do some admin task like create new features)

The client SDKs are not able to create new features or perform admin tasks. Instead you must either use the Admin UI or the Admin API directly.


Does that help a bit? ☺️ And again: sorry for forgetting about this!

from unleash-client-go.

mohitreddy1996 avatar mohitreddy1996 commented on July 19, 2024

@thomasheartman @ivarconr

We use unleash to release server side features and we wanted as automated setup as possible - we have the same binary running for multiple independent workloads (different kubernetes clusters and even in the same cluster, we have independent unleash servers running isolated with namespaces) and we deploy one unleash server for each workload to have isolation (we could named the feature flags accordingly, but chose against it for multiple factors).

To avoid creating API tokens through the UI, we have disabled the authentication for it -

const unleash = require('unleash-server');

unleash.start({
    authentication: {
        enableApiToken: false,
        type: 'none',
    }
});

and wanted to rely on the client side SDK to pass and fetch the feature toggles for different environments.

From your earlier comment, is it not possible to do? Are there any plans to add this back? If not, what could be an easy way to implement such a functionality?

from unleash-client-go.

mohitreddy1996 avatar mohitreddy1996 commented on July 19, 2024

Just wanted to note that, passing request parameters for environment seem to be passing i.e. http://.....:4242/api/client/features?environment=production so maybe this is something which could be implemented?

from unleash-client-go.

thomasheartman avatar thomasheartman commented on July 19, 2024

Hi, @mohitreddy1996 πŸ‘‹πŸΌ

That sounds like an interesting use case! As you've correctly identified, using query parameters should allow you to set the environment. At least I know that it works with Admin tokens. For clients, the new API tokens should take over from that convention. However, if you're not authenticating at all, then ... I don't actually know how it'll work. But judging from the above comment, it seems to work for both client and admin endpoints. Does that mean your problem is solved or was there more to it? ☺️

from unleash-client-go.

mohitreddy1996 avatar mohitreddy1996 commented on July 19, 2024

Hi @thomasheartman ,

Thanks a lot for getting back.

However, if you're not authenticating at all, then ... I don't actually know how it'll work. But judging from the above comment, it seems to work for both client and admin endpoints. Does that mean your problem is solved or was there more to it?

Well it is partially solved. We plan to use the Go SDK, instead of implementing a library of our own which would make these HTTP GET calls with additional query parameters.

I would really appreciate it if there an official support for this - i.e. using environments without any authentication. Using query parameters, quite honestly feels a bit hacky and if it is not documented anywhere, not sure if we can reliably use it?

For the short term, would you be willing to add the support (or accept a PR) to add query parameter for environment for the HTTP GET (/api/client/features) in the Go SDK?

from unleash-client-go.

thomasheartman avatar thomasheartman commented on July 19, 2024

Hmm, I understand your concern. I think the admin UI uses query parameters for that same purpose (at least for the admin endpoints), so I don't think it'll be going away, but it's also not very obvious.

As for changing the Go SDK to add query parameters: I don't know what a good solution is there. Do we ignore the parameter if you have an environment-based API token? Do we only allow you to set it if you have no auth?

That said, it's definitely a valid request, so maybe @ivarconr has some comments? If not, I'd suggest you create a feature request for it describing your use case etc, and we'll discuss it with the team. How does that sound? ☺️

from unleash-client-go.

mohitreddy1996 avatar mohitreddy1996 commented on July 19, 2024

As for changing the Go SDK to add query parameters: I don't know what a good solution is there. Do we ignore the parameter if you have an environment-based API token? Do we only allow you to set it if you have no auth?

Yeah I agree. The concerns and trade-offs with this solution are definitely valid.

That said, it's definitely a valid request, so maybe @ivarconr has some comments? If not, I'd suggest you create a feature request for it describing your use case etc, and we'll discuss it with the team. How does that sound? ☺️

surely I will do that! Thanks a bunch :)

from unleash-client-go.

stale avatar stale commented on July 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from unleash-client-go.

Related Issues (20)

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.