Coder Social home page Coder Social logo

Comments (2)

rafaelfranca avatar rafaelfranca commented on June 7, 2024

When does an integer as credential name makes sense?

from rails.

fabianof avatar fabianof commented on June 7, 2024

Thanks for asking, Rafael.

Following is a real use case from one of my applications (using fake credentials), in which I have a "year => spreadsheet ID" mapping.

google:
  credentials: config/credentials/google/development.json
  spreadsheet_id:
    2021: 81ab723369a5f16cb68d22f67089b4754befbb32a91b
    2022: ede01aa536d886affa5a4795ff76766413f1a5b062f0
    2023: e0b894384abdcbfb7549ab23907435668f7b48c7ff12
    2024: a59545b56a896e821dcf8b8e6315a68c412bbbff531c

With that in place I've been used to do this for a long time:

Rails.application.credentials[:google][:spreadsheet_id][month.year]

Without accepting integer keys, I have to worry about parsing month.year to string (for example), which is not the behavior I would expect from a hash.

from rails.

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.