Git Product home page Git Product logo

Comments (2)

kachkaev avatar kachkaev commented on May 19, 2024

Hi @rafaelschmitt!

How about this?

$ RAND=$(cat /dev/urandom | env LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32)
$ app/console assets_v:set $RAND
Setting parameter assets_version in assets_version.yml to 'a3bbc4645d5f078712ec73e1f4c90907'...
Done. Clearing of prod cache is required.

You can find out more about generating random strings here:
http://stackoverflow.com/questions/2793812/generate-a-random-filename-in-unix-shell

I am deliberately not adding assets_version:set:random command because I don’t find it safe. Although you can generate pretty long sequences of characters, there is still a chance of hitting the same value. If auto-incrementing of assets_version does fit the needs of your project, I’d recommend using a more controlled value. For example, this can be the current timestamp:

$ app/console assets_v:set $(date +"%s")
Setting parameter assets_version in assets_version.yml to '1427469781'...
Done. Clearing of prod cache is required.

from kachkaevassetsversionbundle.

rafaelschmitt avatar rafaelschmitt commented on May 19, 2024

Ok, thank you for your fast and clear answer ;)
This will help us a lot. And you are right, a random hash would be not really safe -> chance of hitting same value.

We will use a combination of timestamp + short hash. Only timestamp would be unsafe for us, because there is a chance that two (or more) installations are started at the absolute same time.

Thanks ;)

from kachkaevassetsversionbundle.

Related Issues (6)

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.