Explorar o código

fix(gateway): Fix git configuration

Signed-off-by: Jeremy MAURO <jeremy.mauro@gmail.com>
Jeremy MAURO %!s(int64=2) %!d(string=hai) anos
pai
achega
42fcfcb00d
Modificáronse 2 ficheiros con 5 adicións e 3 borrados
  1. 2 2
      cookbooks/gateway/attributes/_git.rb
  2. 3 1
      cookbooks/gateway/recipes/_git.rb

+ 2 - 2
cookbooks/gateway/attributes/_git.rb

@@ -1,4 +1,4 @@
-default['workstation']['_git']['system'] = {
+default['gateway']['_git']['system'] = {
   'color.ui': true,
   'color.diff': 'auto',
   'color.status': 'auto',
@@ -23,7 +23,7 @@ default['workstation']['_git']['system'] = {
   'user.name': 'Jeremy from Gateway',
 }
 
-default['workstation']['_git']['global'] = {
+default['gateway']['_git']['global'] = {
   'user.email': 'jeremy.mauro@gmail.com',
   'user.name': 'Jeremy MAURO',
   'url.git@github.com': '.insteadof=https://github.com/',

+ 3 - 1
cookbooks/gateway/recipes/_git.rb

@@ -6,6 +6,8 @@
 
 include_recipe 'git'
 
+username = nil
+
 node['gateway']['_git'].each do |scope_git, git_options|
   if scope_git.match(/^file_/)
     gitconfig_file = $' # String after the match (ref: https://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Special+global+variables)
@@ -15,7 +17,7 @@ node['gateway']['_git'].each do |scope_git, git_options|
     git_config k do
       value v.to_s
       scope scope_git
-      user username if %w{global file}.include?(scope_git)
+      user username if username && %w{global file}.include?(scope_git)
       config_file gitconfig_file if scope_git == 'file'
     end
   end