Reputation: 1788
I'm currently developping a small open-source widget which requires the user to enter it's own API key from Todoist. I publish my code online but as I am developping I'd like to have a git branch with my personal API key that isn't available online and only exists locally on my disk.
Is there a way to achieve this?
Say the code on a said master
branch would be:
api = "___ENTER YOUR API KEY HERE___"
rest of code...
And the code on my personal offline branch would be:
api = "6feee79d-2511-4bc0-ac94-e084237c9cfb"
rest of code...
I'm scared that if I commit a branch, it would automatically get pushed online the next type I run git push
.
Upvotes: 0
Views: 173
Reputation: 451
You could read a file that only has the api key on it.
Set a filename for that file, add it to your .gitignore
and ask the user to provides its own file with its key.
This way you are not making public your key, and the user does not need to change anything in the code source to provide its key.
Upvotes: 1