2023-10-15 09:08:33 +00:00
|
|
|
module.exports = Self => {
|
2023-10-19 06:37:28 +00:00
|
|
|
Self.remoteMethod('getUrl', {
|
2023-10-15 09:08:33 +00:00
|
|
|
description: 'Returns the colling app name',
|
2023-10-19 06:37:28 +00:00
|
|
|
accessType: 'READ',
|
2023-10-15 09:08:33 +00:00
|
|
|
accepts: [
|
|
|
|
{
|
2023-10-19 06:37:28 +00:00
|
|
|
arg: 'app',
|
2023-10-15 09:08:33 +00:00
|
|
|
type: 'string',
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
returns: {
|
|
|
|
type: 'object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/getUrl`,
|
|
|
|
verb: 'get'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Self.getUrl = async(appName = 'salix') => {
|
2023-10-16 16:24:58 +00:00
|
|
|
const {url} = await Self.app.models.Url.findOne({
|
2023-10-15 09:08:33 +00:00
|
|
|
where: {
|
|
|
|
appName,
|
|
|
|
enviroment: process.env.NODE_ENV || 'development'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return url;
|
|
|
|
};
|
|
|
|
};
|