-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] Managing public and private dotfiles with files with the same name but different content, and not both have some files #443
Comments
I was going to test it, but I received the error, because my private and public dotfiles are on my portable SSD. Here is the error message:
|
I understood now. It is because I did not create a config:
backup: true
banner: false
create: true
dotpath: dotfiles
ignoreempty: false
keepdot: true
longkey: false
showdiff: false
workdir: ~/.config/dotdrop
dotfiles:
profiles: I think |
The option |
Hello, (1) Getting dotdrop to auto-generate a default config file when it does not existI understand your point and that would not be very difficult to implement. But mostly I think it might be misleading since the config file contains more than just a list of dotfiles (like the (2) error
|
|
I'm adding a new command ( Regarding calling dotdrop with multiple profiles (3), it is indeed advised to use some bash fu to do what you want to do as those profiles are independant and thus dotdrop should be called for each of them. Your example should work. For (4), yes that's exactly what I'm suggesting, wouldn't that work for you? It's however still not clear to me the use-case for (5). In the end if you share (git, etc) your dotpath but still want some of its content to be private, then you should have them encrypted. If however you want dotdrop to use them if present and not if absent, then you might want to look into something like
You could also use bare profiles, for example
Then you'd selectively use profile |
BTW regarding (4), if you plan on publishing in a public repo your config file, it might not be wise to have your creds in your config file. For that use-case you should use environment variables (see env variables). |
I am going to update
I was going to test and see if it works or not, but you have just said in your last comment. I am going to test it. But, by chance, it is safe to store a According to some hacking and GnuPG experts, a GnuPG encrypted file password can be brute-forced. What GnuPG files should I store and should I not store?
I think I would firstly pick |
I would suggest using asymmetric key cryptography but this is beyond dotdrop. Regarding your test on branch
I think you wanted to use fail-on-non-existing-config. In order to test a branch/PR, you can follow this doc. |
@gusbemacbe FYI I merged the two above PRs and if you use the master branch you should get the fixes. |
Despite your suggestion on that documentation, I prefer installing from git via
What do you think about it? |
I performed a test.
But since that the interested user will want to install with that same command to install the public dotfiles, we will receive the error, saying that the private dotfiles folder is not found. I have tested, renaming |
If you want to test with my compressed files, you can receive it here: |
I also have tested it and haven't liked it because I want to share the files with some environment variables as examples for the learners of the tutorials like SSH and VPS. I think that the import configuration is the best solution with false and true variables on the DotDrop configuration file because it can overwrite the existing files like I have done. |
Yes that's what I discussed in point (1) above. Dotdrop will warn you that you are missing a config file and now provides a command ( |
You might want to read the doc on import_configs here. You have the option to set a imported config as optional (by appending
|
I have tested it with the addition of |
I have investigated, testing without I reviewed the old
If I did not insert this code, with or without I provide the latest compressed file for you to analyse and test: dotdrop-test-02.zip |
I also tested with |
Here's what I tested:
$ dotdrop install --cfg dotfiles-private/config_user.yml -p general
$ cat .cities
CITY="Rome"
$ cat .test-03/cities.md
- Aparecida, São Paulo, Brazil
- Castelnuovo di Garfagnanna, Tuscany, Italy
- Lucca, Tuscany, Italy
- Paris, Île-de-France, France This is working as expected
$ dotdrop install --cfg dotfiles-public/config_user.yml -p tests
[WARN] bad path dotfiles-private/xxxconfig_user.yml
$ cat .cities
CITY="Paris"
$ cat .test-03/cities.md
- Aparecida, São Paulo, Brazil
- Paris, Île-de-France, France This is working as expected
$ dotdrop install --cfg dotfiles-public/config_user.yml -p tests
$ cat .cities
CITY="Rome"
$ cat .test-03/cities.md
- Aparecida, São Paulo, Brazil
- Paris, Île-de-France, France The There's a quick fix: You need to have an unique dotfile name in your private config that targets the same file as the one in the public config, for example (private config):
The issues comes from the fact that when merging imported dotfiles, if there's a name conflict (for example |
I'm working on a fix in #449 |
Actually dotdrop is on purpose giving priority on the importing config's dotfiles. This means imported config's dotfiles will not overwrite importing config's dotfiles. I don't want to modify the way dotdrop works now as people might depend on that behavior. I will however improve the documentation to clearly mention that. Regarding your issue, having a different dotfile name but targeting the same file (as shown above) would solve your issue. Sorry for the misunderstanding. |
Here's the part of the documentation I'm adding through #450
|
If I want to import, but renaming the dotfile keyname? I listed the options for dotdrop import --cfg dotfiles-private/config_user.yml -p tests ~/.test-03 I would run this similar command but a new option: dotdrop import --cfg dotfiles-private/config_user.yml -p tests --name "d_test-03-overwrite" ~/.test-03 |
While you do not answer yet, I will reconsider your branch |
Can you give a try to the user-key-on-import branch? It provides the ability to specify the key you want to use with |
I have just given a try and it worked perfectly! Then people who might depend on that original behaviour will not have problem with the new I will use both |
Awesome, I've merged the branch into master and will release a new version of dotdrop in the coming week. |
I was playing with actions block. It appears that fake dotfiles and actions, and dynamic actions do not give effect. Here is my private dotfiles' dotdrop configuration file: actions:
always_action: 'date > ~/.dotdrop.log'
config:
backup: true
banner: false
create: true
dotpath: dotfiles
keepdot: true
link_dotfile_default: nolink
link_on_import: nolink
longkey: false
variables:
city: "Lucca, Tuscany, Italy"
dotfiles:
fake:
src:
dst:
actions:
- always_action
d_test-03-ow:
src: .test-03
dst: ~/.test-03
d_test-04:
src: .test-04
dst: ~/.test-04
d_test-05:
src: .test-05
dst: ~/.test-05
f_cities:
src: .cities
dst: ~/.cities
profiles:
general:
dotfiles:
- fake
- d_test-03-ow
- d_test-04
- d_test-05
- f_cities I did not find the log file in my home, or in the |
I tested using the branch I tested using the actions tests you suggested from the reference regarding the #391. No effect. The following commands: dotdrop install -tdaf -c "dotfiles-private/config_user.yml" -p "general"
cd "dotfiles-private" && dotdrop install -tdaf -c "config_user.yml" -p "general"
dotdrop install -tdaf -c "dotfiles-public/config_user.yml" -p "tests"
cd "dotfiles-public" && dotdrop install -tdaf -c "config_user.yml" -p "tests" |
I also tested with another reference and no effect. |
@deadc0de6, finally, I could replicate this problem. These actions are possible only if the directory is not temporary. They are not supported with the option |
While you do not solve this issue yet, I have to install without I think you also need to improve the actions:
presource: source ".secrets"
postsource: echo "$GIT_USER" > /tmp/dotdrop-xxx/.gituser I ran the command from the public dotfiles, and it did not find the file because it was in the private dotfiles, not in the public dotfiles. I had to change the destinations to: actions:
presource: source "../dotfiles-private/.secrets" |
Thanks for reporting this. Since it was different from your initial issue and I closed it, it might be have been easier to handle this in a new issue. Indeed, actions are not executed when using
Because What you could do is create a different user with a clean home and test it like that. Or even define a home variable that you could switch to your real home or to a temporary directory, see below (untested) actions:
always_action: 'date > {{@@ myhome @@}}/.dotdrop.log'
config:
backup: true
banner: false
create: true
dotpath: dotfiles
keepdot: true
link_dotfile_default: nolink
link_on_import: nolink
longkey: false
variables:
city: "Lucca, Tuscany, Italy"
myhome: "/tmp/tmphome"
dotfiles:
fake:
src:
dst:
actions:
- always_action
d_test-03-ow:
src: .test-03
dst: "{{@@ myhome @@}}/.test-03"
d_test-04:
src: .test-04
dst: "{{@@ myhome @@}}/.test-04"
d_test-05:
src: .test-05
dst: "{{@@ myhome @@}}/.test-05"
f_cities:
src: .cities
dst: "{{@@ myhome @@}}/.cities"
profiles:
general:
dotfiles:
- fake
- d_test-03-ow
- d_test-04
- d_test-05
- f_cities |
Please forgive me for my autism and ADHD, @deadc0de6! And about |
I'm sorry, what is that? I didn't mean to insult you in my answer and if I did, it wasn't on purpose and I apologize. Can you elaborate on what is the issue with |
I know you do not insult. It was my fault because I read overly or misread or oversaw the text and did not pay attention to the info due to my ADHD and autism.
If I change from |
Ok, I see. The action actions:
presource: source "{{@@ _dotdrop_cfgpath @@}}/.secrets" |
Share content across dotfiles teaches how to manege different dotfiles, but my case is different. One is private and another is public.
I also read Profile block that explained how to manage two private and public profiles, but I can not store sensitive info.
For example, both private and private dotfiles have a same file
.env.private
but a different content. The public dotfiles's.env.private
contains fake password and IP address, while the private dotfile's contains true password and IP address. When to usedotdrop
to install, the public dotfiles's.env.private
file needs to be replaced or overwritten by the private dotfiles's.env.private
file to the local machine.Also, the private dotfiles contain additional files that are not present in the public dotfiles due to sensitive information. For example, the private dotfiles contain few directories and files like
.firestorm
and.mozilla
, etc. I need to copy it to my computer when I use the public dotfiles.Is it possible to combine and merge these two dotfiles, using one or two (
config-user.yaml
andconfig-root.yaml
) from a dotfiles repository (preferably from the public repository), to copy the true files and the missing folders from the private dotfiles?Is it possible to set multiple profiles for
--profile
? For example:The text was updated successfully, but these errors were encountered: