Giter Site home page Giter Site logo

Comments (8)

sascha-wolf avatar sascha-wolf commented on May 17, 2024 1

Thanks for the heads up, the task checks if the flag is set and does nothing if that's the case, exactly to avoid it. It really only is for initial setup. 🙂

from fun_with_flags_ui.

sascha-wolf avatar sascha-wolf commented on May 17, 2024

I'm happy to submit a PR with a fix. Can you point me to the general direction where this needs to be handled? Maybe here?

def path(conn, path) do
Path.join(conn.assigns[:namespace], path)
end

from fun_with_flags_ui.

tompave avatar tompave commented on May 17, 2024

Hi, thank you for trying the library.

That limitation is actually there by design, as explained in the readme:

For this reason this library enforces some stricter rules when creating flags and groups. Blank values are not allowed, ? neither, and flag names must match /^w+$/.
(https://github.com/tompave/fun_with_flags_ui#caveats)

I'd rather not change it because I don't want to add too many escaping rules to the routing. The reason is that technically a flag name could contain anything:

iex(1)> is_atom :"foo?=[aa]🍕nope   😬"
true

And allowing the same variety of chars in an URL is a rabbit hole I'd rather stay away from.

from fun_with_flags_ui.

tompave avatar tompave commented on May 17, 2024

I'm afraid that the solution is to just not use ? in your flag names.

from fun_with_flags_ui.

tompave avatar tompave commented on May 17, 2024

That's also why this web dashboard will prevent you from creating flags with those invalid characters: https://github.com/tompave/fun_with_flags_ui/blob/v0.7.1/lib/fun_with_flags/ui/utils.ex#L128-L139

I imagine that you created the flag check_email_verified? directly in code. On the other hand, if you did manage to create it using the dashboard, then I'd treat that as a bug and I'd be happy to accept a PR that fixes the validation.

from fun_with_flags_ui.

sascha-wolf avatar sascha-wolf commented on May 17, 2024

Fair enough. Yes, we created it in code. We have a task which sets some flags with defaults on startup, basically migration like.

from fun_with_flags_ui.

sascha-wolf avatar sascha-wolf commented on May 17, 2024

I will close this then. Thank you again. :)

from fun_with_flags_ui.

tompave avatar tompave commented on May 17, 2024

No worries, I'm glad that the workaround makes sense. 👍

Fair enough. Yes, we created it in code. We have a task which sets some flags with defaults on startup, basically migration like.

@zeeker I see. I'd just suggest caution with this approach though, because you risk to override some manual flag change when a new process starts. For example, an engineer could manually disable a flag because they have a good reason, but then the flag could get automatically re-enabled if a new application process/container/instance (re)starts somewhere.

from fun_with_flags_ui.

Related Issues (15)

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.