Maxime
Maxime

Reputation: 2270

Atom Package: hide developer keys

I am working on an Atom Package. It needs a developer key to work.

I would like to avoid committing the key. However, to publish an Atom Package, the code needs to be committed in a public repository.

The key is not really secret. Therefore, if it is bundled in the package is not a problem. I just don't want it to be committed in the public repository.

Is there a way to publish an Atom Package that needs a secret key without having to commit the secret key to the project's repository?

Upvotes: 0

Views: 54

Answers (1)

idleberg
idleberg

Reputation: 12882

The most common way would probably a package setting that lets your users enter the key.

Example:

// main.js
export const config = {
  developerKey: {
    title: 'Developer Key',
    description: 'Specify your developer key or [sign up](https://) to get one',
    type: 'string',
    default: ''
  }
};

To get the developer key, you can query using atom.config.get:

atom.config.get(your-package-name.developerKey');

See the Atom API Documentation for details.

Upvotes: 4

Related Questions