onboardbase 1.1.3 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/onboardbase/version.rb +1 -1
 - data/lib/onboardbase.rb +17 -10
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 01b58322eb44c064087a101b20056e4916fa63fe369f09e94dac3ca40203417e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 642a4a3cc9115546d159465eb27b40671da23c711c3aeb235c0f17d5a2a83b7e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 767d1d0b59851f369c64a9fd8e2d9935e5b1438b8895247221354c60d14a4387bbae5f284cbd95e840e8332db5e97d725c2b030fc520eb3f264f211473b35767
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c21c4d07614ab227c6cc07f8b4df62e25b5fb212e48070de5aacc20cfaa97d54806a33dd198319a48d74f6ad733c6fc5fd26efdbde12e50bcf3e76f7baecbdbe
         
     | 
    
        data/lib/onboardbase/version.rb
    CHANGED
    
    
    
        data/lib/onboardbase.rb
    CHANGED
    
    | 
         @@ -196,6 +196,12 @@ module Onboardbase 
     | 
|
| 
       196 
196 
     | 
    
         
             
                  secretsHash.keys.sort.each do |key|
         
     | 
| 
       197 
197 
     | 
    
         
             
                    ENV["#{key}"] = "#{secretsHash[key]}"
         
     | 
| 
       198 
198 
     | 
    
         
             
                  end
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
                  self.overrideWithLocal(ENV)
         
     | 
| 
      
 201 
     | 
    
         
            +
                  ENV.to_hash
         
     | 
| 
      
 202 
     | 
    
         
            +
                end
         
     | 
| 
      
 203 
     | 
    
         
            +
             
     | 
| 
      
 204 
     | 
    
         
            +
                def overrideWithLocal(secrets)
         
     | 
| 
       199 
205 
     | 
    
         
             
                  # Overried local secrets
         
     | 
| 
       200 
206 
     | 
    
         
             
                  configSecrets = self.configuration["secrets"]
         
     | 
| 
       201 
207 
     | 
    
         
             
                  unless configSecrets
         
     | 
| 
         @@ -206,9 +212,9 @@ module Onboardbase 
     | 
|
| 
       206 
212 
     | 
    
         
             
                    localSecrets = {}
         
     | 
| 
       207 
213 
     | 
    
         
             
                  end
         
     | 
| 
       208 
214 
     | 
    
         
             
                  localSecrets.keys.sort.each do |key|
         
     | 
| 
       209 
     | 
    
         
            -
                     
     | 
| 
      
 215 
     | 
    
         
            +
                    secrets["#{key}"] = "#{configSecrets["local"][key]}"
         
     | 
| 
       210 
216 
     | 
    
         
             
                  end
         
     | 
| 
       211 
     | 
    
         
            -
                   
     | 
| 
      
 217 
     | 
    
         
            +
                  secrets
         
     | 
| 
       212 
218 
     | 
    
         
             
                end
         
     | 
| 
       213 
219 
     | 
    
         | 
| 
       214 
220 
     | 
    
         
             
                def hashSecrets?(secretsArr)
         
     | 
| 
         @@ -256,7 +262,8 @@ module Onboardbase 
     | 
|
| 
       256 
262 
     | 
    
         | 
| 
       257 
263 
     | 
    
         
             
                def loadAsCredentials
         
     | 
| 
       258 
264 
     | 
    
         
             
                  # Traditionally fetch secrets into ENV
         
     | 
| 
       259 
     | 
    
         
            -
                  self.loadSecrets
         
     | 
| 
      
 265 
     | 
    
         
            +
                  secrets = self.loadSecrets
         
     | 
| 
      
 266 
     | 
    
         
            +
                  # Load rails encryption module
         
     | 
| 
       260 
267 
     | 
    
         
             
                  require "active_support/encrypted_configuration"
         
     | 
| 
       261 
268 
     | 
    
         
             
                  credentials = ActiveSupport::EncryptedConfiguration.new(
         
     | 
| 
       262 
269 
     | 
    
         
             
                      config_path: self.content_path,
         
     | 
| 
         @@ -265,14 +272,13 @@ module Onboardbase 
     | 
|
| 
       265 
272 
     | 
    
         
             
                      raise_if_missing_key: true
         
     | 
| 
       266 
273 
     | 
    
         
             
                    )
         
     | 
| 
       267 
274 
     | 
    
         | 
| 
       268 
     | 
    
         
            -
                   
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
                    end
         
     | 
| 
      
 275 
     | 
    
         
            +
                  encsecrets = YAML.load(credentials.read)
         
     | 
| 
      
 276 
     | 
    
         
            +
                  # secrets hash
         
     | 
| 
      
 277 
     | 
    
         
            +
                  encsecrets.keys.sort.each do |key|
         
     | 
| 
      
 278 
     | 
    
         
            +
                    secrets["#{key}"] = "#{encsecrets[key]}"
         
     | 
| 
       273 
279 
     | 
    
         
             
                  end
         
     | 
| 
       274 
     | 
    
         
            -
             
     | 
| 
       275 
     | 
    
         
            -
                  credentials.write( 
     | 
| 
      
 280 
     | 
    
         
            +
                  # Append all environment variable
         
     | 
| 
      
 281 
     | 
    
         
            +
                  credentials.write(secrets.to_yaml)
         
     | 
| 
       276 
282 
     | 
    
         
             
                end
         
     | 
| 
       277 
283 
     | 
    
         | 
| 
       278 
284 
     | 
    
         
             
                def loadSecrets
         
     | 
| 
         @@ -289,6 +295,7 @@ module Onboardbase 
     | 
|
| 
       289 
295 
     | 
    
         
             
                  end
         
     | 
| 
       290 
296 
     | 
    
         
             
                  finalEnvs = self.setEnv(secrets)
         
     | 
| 
       291 
297 
     | 
    
         
             
                  self.storeToFallback?(finalEnvs)
         
     | 
| 
      
 298 
     | 
    
         
            +
                  self.overrideWithLocal(secrets)
         
     | 
| 
       292 
299 
     | 
    
         
             
                end
         
     | 
| 
       293 
300 
     | 
    
         
             
              end
         
     | 
| 
       294 
301 
     | 
    
         
             
            end
         
     |