Allow template to be a whole directory#57
Conversation
jwilder
left a comment
There was a problem hiding this comment.
Can you update the README with details on how this work? If a dir is passed in, does it just create the new generated file in the dest dir using the name of file in the src dir as the template?
|
@jwilder just updated the README. |
|
@jwilder is there still something missing for this PR to be merged? |
|
I am also loking for this feature simply because i have sites_enabled in my nginx, and everyone of them i need to transform into a template. Glad there is PR already. |
|
@jwilder would love to get some feedback. |
|
@jwilder I have updated the README, as you asked me to do. how do you want me to proceed? |
dockerize.go
Outdated
| log.Fatalf("unable to stat %s, error: %s", template, err) | ||
| } | ||
| if fi.IsDir() { | ||
| if dest != "" { |
There was a problem hiding this comment.
Could you move this whole block L241-L262 to a separate func like generateDir?
dockerize.go
Outdated
|
|
||
| for _, file := range files { | ||
| if dest == "" { | ||
| generateFile(template+string(os.PathSeparator)+file.Name(), "") |
There was a problem hiding this comment.
You can use filepath.Join(template, file.Name) here
dockerize.go
Outdated
| if dest == "" { | ||
| generateFile(template+string(os.PathSeparator)+file.Name(), "") | ||
| } else { | ||
| generateFile(template+string(os.PathSeparator)+file.Name(), dest+string(os.PathSeparator)+file.Name()) |
There was a problem hiding this comment.
Ditto: file path.Join(...) for these.
Use filepath.Join Implement review feedback from jwilder
|
@jwilder just implemented your suggestions. |
|
Thanks @breml! |
Use-case: process complete conf.d directories without the need to list every file separately.