Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Webservices API keys

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1861 Views
  • Ofir Picazo
    Avatar
    Google Summer of Code Hacker
    7 Posts

    Webservices API keys Link to this post

    I was thinking we should probably agree on a way of storing the API keys so we can share them amongst the projects.
    Do you have any ideas of a good table schema for it?

  • Hayden
    Avatar
    Core Development Team
    19 Posts

    Re: Webservices API keys Link to this post

    That makes sense to me. Typically, we store this sort of information in the _config.php file of the main module for your project (the one with the same name as your project). Using PHP's define function is typically the way to create a constant string for this.

    We hope to have the gsoc branch set up in SVN shortly, and adding it to the shared _config.php file will ensure that the other GSoC people have the keys as well.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Webservices API keys Link to this post

    The other way to set up configuration options is to create static methods on your application's classes. Something like:

    GoogleMapsIntegration::set_api_key('dfadsfasdfasdfasdfasd');

    This has the advantage of being easy to spot in an API documentation or by browsing the function listing in the code.

  • laktek
    Avatar
    Google Summer of Code Hacker
    76 Posts

    Re: Webservices API keys Link to this post

    I agree with Sam on the static method implementation. Mashup module classes will follow that standard.

    1861 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.