mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
update config
This commit is contained in:
parent
e91042194a
commit
fd657fc4a8
@ -8,24 +8,16 @@ const writeFileAtomic = require('write-file-atomic');
|
||||
const getFrameworkId = require('../getFrameworkId');
|
||||
const fileExistsSync = require('../fs/fileExistsSync');
|
||||
const readFileSync = require('../fs/readFileSync');
|
||||
const getServerlessDir = require('../getServerlessDir');
|
||||
const isTrackingDisabled = require('../isTrackingDisabled');
|
||||
|
||||
const globalConfigPath = path.join(os.homedir(), '.serverlessrc');
|
||||
|
||||
function legacyIsTrackingDisabled() {
|
||||
if (fileExistsSync(path.join(getServerlessDir(), 'stats-disabled'))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function createConfig() {
|
||||
// set default config options
|
||||
const config = {
|
||||
userId: null, // currentUserId
|
||||
frameworkId: getFrameworkId(),
|
||||
settings: {
|
||||
trackingDisabled: legacyIsTrackingDisabled(),
|
||||
},
|
||||
trackingDisabled: isTrackingDisabled(),
|
||||
};
|
||||
writeFileAtomic.sync(globalConfigPath, JSON.stringify(config, null, 2));
|
||||
return JSON.parse(readFileSync(globalConfigPath));
|
||||
@ -79,7 +71,7 @@ function deleteConfigValue(key) {
|
||||
}
|
||||
|
||||
// set local config value /project/.serverlessrc
|
||||
// function setLocalConfig
|
||||
// function setLocalConfig() {}
|
||||
|
||||
// set .serverlessrc config value
|
||||
function getConfigValue(objectPath) {
|
||||
@ -95,5 +87,6 @@ module.exports = {
|
||||
get: getConfigValue,
|
||||
delete: deleteConfigValue,
|
||||
getConfig,
|
||||
getGlobalConfig,
|
||||
CONFIG_FILE_PATH: globalConfigPath,
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user