MCPcopy Create free account
hub / github.com/serverless/serverless / getRcGlobalPath

Function getRcGlobalPath

packages/util/src/rc/index.js:78–95  ·  view source on GitHub ↗
(baseFilename)

Source from the content-addressed store, hash-verified

76 * @returns
77 */
78const getRcGlobalPath = async (baseFilename) => {
79 const homeConfigGlobalConfigPath = getRcDefaultConfigPath(baseFilename)
80 const defaultGlobalConfigPath = getRcDefaultPath(baseFilename)
81 const homeConfigGlobalConfigExists = await fileExists(
82 homeConfigGlobalConfigPath,
83 )
84 const defaultGlobalConfigExists = await fileExists(defaultGlobalConfigPath)
85
86 if (homeConfigGlobalConfigExists && defaultGlobalConfigExists) {
87 return defaultGlobalConfigPath
88 }
89
90 if (homeConfigGlobalConfigExists) {
91 return homeConfigGlobalConfigPath
92 }
93
94 return defaultGlobalConfigPath
95}
96
97/**
98 * Gets the .{baseFilename}rc configuration file in the current working directory, if it exists.

Callers 6

saveRcAuthenticatedUserFunction · 0.90
saveRcAccessKeyV2Function · 0.90
removeRcUserSessionFunction · 0.90
removeRcAccessKeyV2Function · 0.90
getRcGlobalConfigFunction · 0.85

Calls 3

getRcDefaultConfigPathFunction · 0.85
getRcDefaultPathFunction · 0.85
fileExistsFunction · 0.70

Tested by

no test coverage detected