I am trying to use picture stored on HD as a profile picture of jhipster user, I'm having troubles with the url. I have tried :
file:///C:/Users/ab/Documents/myApp/uploads/profile_picture.png - Not worked.
Also tryed to place profile_picture in the same folder as the navbar.components.html and changing the url to just: profile_picture.png, but the image did not appear on the navbar. However when i am using any img url from any Google image, the profile picture is there.
As I am new with Jhipster I would like to know what am i doing wrong?
Is it possible to use pictures on HD as a jhipster user's profile picture?
Thanks in advance!
All about my project:
"jhipsterVersion": "4.14.1",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "ehcache",
"enableHibernateCache": true,
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": false,
"buildTool": "maven",
"enableSocialSignIn": true,
"enableSwaggerCodegen": false,
"jwtSecretKey": "",
"clientFramework": "angularX",
"useSass": false,
"clientPackageManager": "yarn",
"applicationType": "monolith",
"jhiPrefix": "jhi",
"enableTranslation": false
Finally solved my problem!
It was really obvious. In your JHipster app directory, there is a file named target/www/content which is accessible from the server. So, in your database, in JHI-USERS table, in img_url field write: content/NAME_OF_PICTURE.png and it will work.
Related
Is there any possible ways to add answer for this question "may we anonymously report usage statistics to improve the tool over time?", which is asked as the 1st question when I hit "yo jhipster --force" on cmd, in .yo-rc.json. My .yo-rc.json file contains different required details but no answer for the above mentioned question.
As the jhipster gets reinstalled everytime deployment is done on kubernets and the image gets recreated, and then jhipster command ran from script, it gets stuck at the first question prompt whose answer I am expecting to be taken from .yo-rc.json file, which is otherwise a manual task to go into cmd and manually answer the prompt for every deployment.
I am attaching my .yo-rc.json file. Please help me with my requirement.
{
"generator-jhipster": {
"baseName": "localApp",
"packageName": "com.cg.localApp",
"packageFolder": "com/cg/localApp",
"serverPort": "*****",
"authenticationType": "session",
"hibernateCache": "ehcache",
"clusteredHttpSession": "no",
"websocket": false,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": false,
"buildTool": "maven",
"enableSocialSignIn": false,
"useSass": true,
"applicationType": "monolith",
"testFrameworks": ["gatling", "cucumber", "protractor"],
"jhiPrefix": "cg",
"enableTranslation": false,
"jhipsterVersion": "6.10.3",
"cacheProvider": "ehcache",
"messageBroker": false,
"serviceDiscoveryType": false,
"rememberMeKey": "****",
"embeddableLaunchScript": false,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "none",
"creationTimestamp": 1608305785798,
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"blueprints": []
}
}
There's an undocumented command line option --no-insight which does this, so you could use in .yo-rc.json as "noInsight": true.
But deployment process should not require jhipster command, so I suspect something is wrong in your approach.
I am using jhipster version v6.5.0
When I am creating microservice gateway it asks for a database with the following error.
ERROR! Error: The entity cannot be generated as the application does not have a database configured!
Actually First I created a gateway with database and entities will work after my microservices are not running. That means it works as monolithic and I could see all JPA servicers in the gateway. Swagger API showing fine. But menu from Entities not using microservices.
.yo-rc.json
{
"generator-jhipster": {
"promptValues": {
"packageName": "com.xxx.gate",
"nativeLanguage": "en"
},
"jhipsterVersion": "6.5.0",
"applicationType": "gateway",
"baseName": "myGate2",
"packageName": "com.xxx.gate",
"packageFolder": "com/xxx/gate",
"serverPort": "8080",
"authenticationType": "jwt",
"cacheProvider": "hazelcast",
"enableHibernateCache": false,
"websocket": "spring-websocket",
"databaseType": "no",
"devDatabaseType": "no",
"prodDatabaseType": "no",
"searchEngine": false,
"messageBroker": false,
"serviceDiscoveryType": "eureka",
"buildTool": "maven",
"enableSwaggerCodegen": false,
"jwtSecretKey": "XXXXXXXX",
"embeddableLaunchScript": false,
"useSass": true,
"clientPackageManager": "npm",
"clientFramework": "angularX",
"clientTheme": "lumen",
"clientThemeVariant": "dark",
"jhiPrefix": "jhi",
"entitySuffix": "",
"dtoSuffix": "DTO",
"otherModules": [],
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en"
],
"blueprints": []
}
Please help
JHipster gateway does not persist entities, it's the responsibility of the microservices. This is why you are not able to generate entities in your gateway, the gateway will only import your microservices entities to generate frontend for them.
Rather than converting your monolith into a gateway, you should import your existing entities into a new service.
I tried several possibilities. After changing my angular service class below it starts working as expected(calling microservice rather going directly to gateway).
Generated
public resourceUrl = SERVER_API_URL + 'api/countries';
Changed to
public resourceUrl = SERVER_API_URL + 'services/myservice/api/countries';
I am not sure that is the correct way that Jhipster expected. I have noticed that in gateway SORS filter too.
If you have any git project build with Angular Entities it would be great to understand better.
Thank you for your attention and help.
I have generated a JHipster application using these values:
{
"generator-jhipster":
{
"jhipsterVersion": "4.13.0",
"baseName": "app",
"packageName": "my.app",
"packageFolder": "my/app",
"serverPort": "8080",
"authenticationType": "session",
"hibernateCache": "ehcache",
"clusteredHttpSession": "no",
"websocket": "no",
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"prodDatabaseType": "mysql",
"searchEngine": "elasticsearch",
"buildTool": "gradle",
"enableSocialSignIn": false,
"rememberMeKey": "",
"clientFramework": "angularX",
"useSass": true,
"applicationType": "monolith",
"testFrameworks": [],
"jhiPrefix": "jhi",
"enableTranslation": false
}
}
I would like to allow anonymous users to view an entity, but not update or delete that entity.
I have tried editing the generated SecurityConfiguration.java file to add permitAll(HttpMethod.GET,"/**") for authorizeRequests() in the configure(HttpSecurity http) method.
.and()
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/api/products").permitAll()
I am still getting this message when I try to access the entity.
Resolved exception caused by Handler execution: org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access this resource
I know is similar to this question: JHipster: Enable anonymous users to read entity, but not update?
I have tried to use the same solution here but it's not working. Is there something I should change in the front end ?
Can you help me on this?
Thank you
Attached is the json. My coworker is able to upload his files properly, I've even tried his json config, we're using the same username/password and other creds.
So if I download a file it works fine, (for example theirdomain.com/html/resources/views/home.php), but if I upload the same file it will upload the file to theirdomain.com/html instead of the path its actually located.
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "ftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "host",
"user": "theiruser",
"password": "password",
//"port": "22",
"remote_path": "/domains/theirdomain.com/html/",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
"allow_config_upload": true,
}
I have been trying to set up a remote (FTP) access to some playground files on AWS EC2 instance. Having created an FTP user and installed vsftp, I kept getting a "connection timeout" from Sublime/SFTP. I decided to try the SSH key route. Here is my server setup in SFTP. It also gets "connection timeout." What could be the reason for this? Is this on the client or server side?
Now, before anyone suggests it, I do have port 22 as my SSH port in AWS Security Groups / Inbound Rules settings.
I blanked out some entries like server, password and keyname.
// sftp, ftp or ftps
"type": "sftp",
"sync_down_on_open": true,
"sync_same_age": true,
"host": "ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com",
"user": "ec2",
//"password": "******",
"port": "22",
"remote_path": "/home/user/",
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
"ssh_key_file": " ~/.ssh/file.pem",
//"sftp_flags": ["-F", "~/.ssh/file.pem"],
"sftp_flags": ["-o IdentityFile=/Users/user/.ssh/file.pem"]
//"sftp_flags": ["-o", IdentityFile="/Users/user/.ssh/file.pem"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,
}
This worked for me:
{
"type": "sftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "1.2.3.4", //IPv4 Public IP in Instances > Desription tab of EC2 Dashboard
"user": "ec2-user",
"port": "22",
"remote_path": "/var/www/html/",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
"connect_timeout": 10,
"ssh_key_file": "C:/Users/me/Desktop/aws.ppk", //Generated ppk file using PuTTYgen
}