+ return join(localConfigDir, filename + '.json')
+}
+
+function getLocalConfigDir () {
+ if (process.env.PEERTUBE_LOCAL_CONFIG) return process.env.PEERTUBE_LOCAL_CONFIG
+
+ const configSources = config.util.getConfigSources()
+ if (configSources.length === 0) throw new Error('Invalid config source.')
+
+ return dirname(configSources[0].name)