mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	conf: support overriding context configuration in a different location
Allows placing override configuration files into a different directory. This is Useful when pipewire clients such as wireplumber want their fully commented configuration files under /etc/wireplumber, and fully uncommented configuration files under /usr/share/wireplumber. The point is solving the issue of users copying files from /usr/share/pipewire, which contain various critical settings in addition to tweaking the config, and then encountering problems at upgrade time when new critical settings are added.
This commit is contained in:
		
							parent
							
								
									a9cf72932a
								
							
						
					
					
						commit
						b718dd5046
					
				
					 2 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
					@ -933,6 +933,28 @@ int pw_conf_load_conf_for_context(struct pw_properties *props, struct pw_propert
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						conf_name = pw_properties_get(props, PW_KEY_CONFIG_OVERRIDE_NAME);
 | 
				
			||||||
 | 
						if (conf_name != NULL) {
 | 
				
			||||||
 | 
							struct pw_properties *override;
 | 
				
			||||||
 | 
							const char *path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							override = pw_properties_new(NULL, NULL);
 | 
				
			||||||
 | 
							if (override == NULL) {
 | 
				
			||||||
 | 
								res = -errno;
 | 
				
			||||||
 | 
								return res;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							conf_prefix = pw_properties_get(props, PW_KEY_CONFIG_OVERRIDE_PREFIX);
 | 
				
			||||||
 | 
							if ((res = try_load_conf(conf_prefix, conf_name, override)) < 0) {
 | 
				
			||||||
 | 
								pw_log_error("can't load default override config %s: %s",
 | 
				
			||||||
 | 
									conf_name, spa_strerror(res));
 | 
				
			||||||
 | 
								pw_properties_free (override);
 | 
				
			||||||
 | 
								return res;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							path = pw_properties_get(override, "config.path");
 | 
				
			||||||
 | 
							add_override(conf, override, path, 0, 1);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +76,8 @@ extern "C" {
 | 
				
			||||||
/* config */
 | 
					/* config */
 | 
				
			||||||
#define PW_KEY_CONFIG_PREFIX		"config.prefix"		/**< a config prefix directory */
 | 
					#define PW_KEY_CONFIG_PREFIX		"config.prefix"		/**< a config prefix directory */
 | 
				
			||||||
#define PW_KEY_CONFIG_NAME		"config.name"		/**< a config file name */
 | 
					#define PW_KEY_CONFIG_NAME		"config.name"		/**< a config file name */
 | 
				
			||||||
 | 
					#define PW_KEY_CONFIG_OVERRIDE_PREFIX	"config.override.prefix"	/**< a config override prefix directory */
 | 
				
			||||||
 | 
					#define PW_KEY_CONFIG_OVERRIDE_NAME	"config.override.name"	/**< a config override file name */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* context */
 | 
					/* context */
 | 
				
			||||||
#define PW_KEY_CONTEXT_PROFILE_MODULES	"context.profile.modules"	/**< a context profile for modules, deprecated */
 | 
					#define PW_KEY_CONTEXT_PROFILE_MODULES	"context.profile.modules"	/**< a context profile for modules, deprecated */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue