postgresql: make the locale configurable

This commit is contained in:
Girish Ramakrishnan
2020-10-12 18:57:34 -07:00
parent f9f44b18ad
commit 4836b16030
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -1453,7 +1453,8 @@ function setupPostgreSql(app, options, callback) {
const data = {
database: database,
username: username,
password: error ? hat(4 * 128) : existingPassword
password: error ? hat(4 * 128) : existingPassword,
locale: options.locale || 'C'
};
getContainerDetails('postgresql', 'CLOUDRON_POSTGRESQL_TOKEN', function (error, result) {
@@ -1487,13 +1488,14 @@ function clearPostgreSql(app, options, callback) {
assert.strictEqual(typeof callback, 'function');
const { database, username } = postgreSqlNames(app.id);
const locale = options.locale || 'C';
debugApp(app, 'Clearing postgresql');
getContainerDetails('postgresql', 'CLOUDRON_POSTGRESQL_TOKEN', function (error, result) {
if (error) return callback(error);
request.post(`https://${result.ip}:3000/databases/${database}/clear?access_token=${result.token}&username=${username}`, { json: true, rejectUnauthorized: false }, function (error, response) {
request.post(`https://${result.ip}:3000/databases/${database}/clear?access_token=${result.token}&username=${username}&locale=${locale}`, { json: true, rejectUnauthorized: false }, function (error, response) {
if (error) return callback(new BoxError(BoxError.ADDONS_ERROR, `Network error clearing postgresql: ${error.message}`));
if (response.statusCode !== 200) return callback(new BoxError(BoxError.ADDONS_ERROR, `Error clearing postgresql. Status code: ${response.statusCode} message: ${response.body.message}`));