private static <T extends ConfigInstance> ConfigSubscription<T> getDirFileSub(ConfigKey<T> key, ConfigSource source) {
        DirSource dir = source instanceof DirSource dirSource ? dirSource
                                                              : new DirSource(new File(key.getConfigId().replace("dir:", "")));
        return new FileConfigSubscription<>(key, dir.getFile(getConfigFilename(key)));
    }
Correct type of ConfigSubscription instance based on type of source or form of config id

@param key        a {@link ConfigKey}
@return a subclass of a ConfigsSubscription
config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java