Private Config
![](/file/c626156d7f549d1c8dac8.gif)
🔞 ALL INFORMATION CLICK HERE 👈🏻👈🏻👈🏻
Private Config
Sign up or log in to customize your list.
more stack exchange communities
company blog
Stack Overflow for Teams
– Start collaborating and sharing organizational knowledge.
Create a free Team
Why Teams?
Asked
3 years, 4 months ago
Highest score (default)
Trending (recent votes count more)
Date modified (newest first)
Date created (oldest first)
38.1k 3 3 gold badges 29 29 silver badges 49 49 bronze badges
225k 40 40 gold badges 323 323 silver badges 333 333 bronze badges
771 8 8 silver badges 13 13 bronze badges
Stack Overflow
Questions
Help
Products
Teams
Advertising
Collectives
Talent
Company
About
Press
Work Here
Legal
Privacy Policy
Terms of Service
Contact Us
Cookie Settings
Cookie Policy
Stack Exchange Network
Technology
Culture & recreation
Life & arts
Science
Professional
Business
API
Data
Accept all cookies
Customize settings
Find centralized, trusted content and collaborate around the technologies you use most.
Connect and share knowledge within a single location that is structured and easy to search.
I have a few projects on github that I release in such a way that it's ready to deployed by anyone. I have configuration files like:
I would like to deploy from the same codebase except that I need to add a couple more files that should be private. The files would then look like this:
This means that the files in the public project are a strict subset.
How can we handle such private configuration files?
with a private fork? if so, how do you ensure they are in sync?
My goal is to reduce duplication, i.e use only one codebase if at all possible.
Edit:
I could put the files in .gitignore but they would no longer be under version control, hence not visible by the deployment pipeline.
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
My usual advice is that local (or private) configuration information should be kept out of source control using techniques like templates in place of real config files.
What's different here is that you want to exclude the existence of entire config files, while still wanting the represented in source control.
Your stated reason to have them in source control is visibility to the build pipeline. There are other ways to make a file available to your build pipeline, and if that's the only reason for source-controlling the files, then I recommend using one of those mechanisms instead. Details would depend on your build tools, but surely you can give the build process access to a shared folder and copy the files when they're needed.
On the other hand, if you need to sync historical versions of the files, that's a more difficult problem. That is, maybe at release 5 the required contents changed, but you still need the build process to use the old contents if you check out / build version 4.
In that case, you could consider creating a branch to hold your build versions (including the private config files). There are two good reasons not to do this:
(!) As a general rule, having different branches to store different sets of content can lead to problems. People coming from tools like TFVC sometimes make a general practice of having "a branch for this project and another branch for that project", which leads to trouble. Or people want a branch to represent a subset of the overall content, but when they merge it back they're surprised because a bunch of their files get deleted from master. Etc...
In this case, with the "odd" branch being a superset of the other content, many of the usual problems won't apply, but it's still not a practice to consider without a very solid reason.
(2) You'd have to be careful to never leak info from the "private' branch; there are a lot of potential ways to make a mistake. Obviously don't merge from that branch to any other branch, etc.
How to keep the branch private? Well, if the hosting software for the remote supports branch-level permissions, that might help. If not, you never push the private branch to the public remote; instead maybe you have a second remote for your build process.
So the first time you're going to do a build, you check out the release version, create the "private build" branch, on the branch add the config files, and off you go. Then each subsequent release version, you merge the release to the "private build" branch, editing the private config files as needed (either during the merge, or in a commit right before the merge).
Consider something like Shopify's EJson library. It allows you to use asymmetric encryption to store production configuration in the repo, meaning it is versioned along with the consuming code.
You can use this to have different sets of configuration (ie dev/test/production), storing the dev/test credentials in plain text so that your developers can run the app, but storing the production credentials encrypted so that only the production environment can decrypt them.
Another way, in this case, is to create a private repo. And automatically export your public repo part to another public git repo by tolls like https://github.com/open-condo-software/gitexporter .
Then you will have only one source of truth with history and work inside one repository.
It's better also to use some CI script that executes gitexport automatically.
Sich approach is called giterminism
Thanks for contributing an answer to Stack Overflow!
By clicking “Post Your Answer”, you agree to our terms of service , privacy policy and cookie policy
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2022.9.6.42960
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
Mistress Drink My Pee
Naked Milf Photo
Simpsons Naked