mirror of
				https://github.com/therootcompany/greenlock.js.git
				synced 2024-11-16 17:29:00 +00:00 
			
		
		
		
	default to local basePath
This commit is contained in:
		
							parent
							
								
									7313167ca0
								
							
						
					
					
						commit
						5788abac1e
					
				
							
								
								
									
										23
									
								
								greenlock.js
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								greenlock.js
									
									
									
									
									
								
							@ -420,6 +420,15 @@ G.create = function(gconf) {
 | 
			
		||||
        // packageAgent, maintainerEmail
 | 
			
		||||
        return greenlock._acme(args).then(function(acme) {
 | 
			
		||||
            var storeConf = args.store || mconf.store;
 | 
			
		||||
            storeConf = JSON.parse(JSON.stringify(storeConf));
 | 
			
		||||
            storeConf.packageRoot = gconf.packageRoot;
 | 
			
		||||
            if (storeConf.basePath) {
 | 
			
		||||
                var path = require('path');
 | 
			
		||||
                storeConf.basePath = path.resolve(
 | 
			
		||||
                    gconf.packageRoot || process.cwd(),
 | 
			
		||||
                    'greenlock'
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
            return P._loadStore(storeConf).then(function(store) {
 | 
			
		||||
                return A._getOrCreate(
 | 
			
		||||
                    greenlock,
 | 
			
		||||
@ -493,20 +502,26 @@ function mergeDefaults(MCONF, gconf) {
 | 
			
		||||
        MCONF.subscriberEmail = gconf.subscriberEmail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var homedir;
 | 
			
		||||
    // Load the default store module
 | 
			
		||||
    if (!MCONF.store) {
 | 
			
		||||
        if (gconf.store) {
 | 
			
		||||
            MCONF.store = gconf.store;
 | 
			
		||||
        } else {
 | 
			
		||||
            homedir = require('os').homedir();
 | 
			
		||||
            MCONF.store = {
 | 
			
		||||
                module: 'greenlock-store-fs',
 | 
			
		||||
                basePath: homedir + '/.config/greenlock/'
 | 
			
		||||
                module: 'greenlock-store-fs'
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ('greenlock-store-fs' === MCONF.store.module && !MCONF.store.basePath) {
 | 
			
		||||
        //homedir = require('os').homedir();
 | 
			
		||||
        if (gconf.configFile) {
 | 
			
		||||
            MCONF.store.basePath = gconf.configFile.replace(/\.json$/i, '.d');
 | 
			
		||||
        } else {
 | 
			
		||||
            MCONF.store.basePath = './greenlock.d';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // just to test that it loads
 | 
			
		||||
    P._loadSync(MCONF.store.module);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user