Skip to content

Conversation

@chenbxun
Copy link

What this PR does / why we need it:
This PR introduces an HTTP service for creating snapshots.
The service listens on 0.0.0.0 and handles snapshot creation requests. Upon receiving a request, it locates the corresponding image file by the given device ID and calls the image's create_snapshot() interface.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

src/config.h Outdated
APPCFG_CLASS
APPCFG_PARA(enable, bool, false);
APPCFG_PARA(domainSocket, std::string, "");
APPCFG_PARA(address, std::string, "http://0.0.0.0:12345/snapshot");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://0.0.0.0:12345 is ok.
It should be used as an HTTP address for multiple functions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use '127.0.0.1' as default for security reason

return ret;
}

int SnapshotHandler::handle_request(photon::net::http::Request& req,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to an individual file, such as 'api_server.cpp'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants