public (ISecretBackend backend, string path) ResolveSecretMount(string mountAndPath) { if (string.IsNullOrEmpty(mountAndPath)) { return(null, null); } string mount = mountAndPath; string path = string.Empty; while (!_secretMounts.Exists(mount)) { int lastSlash = mount.LastIndexOf('/'); if (lastSlash <= 0) { // No more splitting and no match return(null, null); } path = $"{mount.Substring(lastSlash + 1)}/{path}"; mount = mount.Substring(0, lastSlash); } return(_secretMounts.Get(mount), path); }
// ############################################################################################# // Internals // ############################################################################################# /** **************************************************************************************** * Retrieves and optionally creates an entry in the map that stores language-related * scope information. The result is stored in field #actPathMapNode. * @param create If \c true, a non-existing entry is created. ******************************************************************************************/ protected void getPathMapNode(bool create) { lazyLanguageNode = false; // key: Path languageKey._()._(scopeInfo.GetTrimmedPath()); if (actScope == Scope.Path) { // substract folders at the back int pathLevel = actPathLevel; while (pathLevel > 0) { int idx = languageKey.LastIndexOf(Path.DirectorySeparatorChar); if (idx < 0) { languageKey._(); break; } languageKey.SetLength_NC(idx); pathLevel--; } languageKey._(separators[1]); actPathMapNode = languageStore.Get(languageKeySubstr.Set(languageKey), create, separators); return; } else { languageKey._(separators[1]); } // key: filename languageKey._(scopeInfo.GetFileName()) ._(separators[0]); // key: method if (actScope == Scope.Method) { languageKey._(scopeInfo.GetMethod()) ._(separators[0]); } actPathMapNode = languageStore.Get(languageKeySubstr.Set(languageKey), create, separators); }