Skip to content
Snippets Groups Projects
Commit 44f91538 authored by Paulo Pimenta's avatar Paulo Pimenta
Browse files

refactor(.gitignore): Added fdp settings to .gitgnore. Some minor changes

parent 6f3fe74f
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,9 @@ target/
!**/src/main/**/target/
!**/src/test/**/target/
##Settings file
src/main/resources/f2pconf/*.*
### STS ###
.apt_generated
.classpath
......
......@@ -35,12 +35,15 @@ public class SmartHarvesterF2DSSettingsController {
@PostMapping (value="/update", consumes="application/json")
public ResponseEntity<?> updateSettings(@RequestBody String f2DSSettings) {
public ResponseEntity<?> updateSettings(@RequestBody F2PSettings f2pSettings) {
File file = new File("src/main/resources" + f2pConfFilePath);
try {
System.out.println("New data : " + f2DSSettings + " filename : " + f2pConfFilePath);
fileEditor.updateFile(f2DSSettings,file);
Gson gson = new Gson();
String f2pSettingsAsString = gson.toJson(f2pSettings);
fileEditor.updateFile(f2pSettingsAsString,file);
return ResponseEntity.ok().body(new MessageResponse("F2P configuration was successfully updated",
HttpStatus.OK));
}
......@@ -68,8 +71,7 @@ public class SmartHarvesterF2DSSettingsController {
} catch (UncheckedIOException | IOException e) {
return ResponseEntity
.badRequest()
.body(new MessageResponse("Could not load settings for F2DS : " +
e.getLocalizedMessage(), HttpStatus.BAD_REQUEST));
.body(new MessageResponse("Could not load settings for F2DS", HttpStatus.NOT_FOUND));
}
}
}
package com.smartharvester.model.f2p;
import io.swagger.annotations.ApiModelProperty;
public class F2PSettings {
@ApiModelProperty(
value = "Title of your F2DP application",
name = "title",
dataType = "String",
example = "My F2DP application")
String title;
String fdpUrl;
String fdpEmail;
......
{
"title": "Toto4",
"fdpUrl": "http://172.17.0.34",
"fdpEmail": "albert.einstein@example.com",
"fdpPassword": "password",
"smartApiUrl": "http://172.17.0.3:30306",
"mongoUrl": "51.178.69.150",
"mongoUser": "admin",
"mongoPassword": "adminadmin"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment