Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56927555
kernel.rs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
kernel.rs
View Options
// -------------------------------------------------------------
// Alkane :: Server :: Kernel
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Project: Nasqueron
// License: BSD-2-Clause
// -------------------------------------------------------------
use
axum
::
Router
;
use
axum
::
routing
::{
get
,
post
};
use
limiting_factor_axum
::
app
::{
App
,
ServerConfig
};
use
crate
::
config
::
AlkaneConfig
;
use
crate
::
server
::
requests
::
*
;
// -------------------------------------------------------------
// Server entry point
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
pub
fn
get_default_config
()
->
ServerConfig
{
ServerConfig
{
address
:
"localhost"
.
to_string
(),
port
:
8000
,
mount_point
:
"/"
.
to_string
(),
}
}
pub
fn
get_router
()
->
Router
<
AlkaneConfig
>
{
Router
::
new
()
// Monitoring
.
route
(
"/status"
,
get
(
status
))
// Alkane API
.
route
(
"/init/{site_name}"
,
post
(
init
))
.
route
(
"/update/{site_name}"
,
post
(
update
))
.
route
(
"/deploy/{site_name}"
,
post
(
deploy
))
.
route
(
"/is_present/{site_name}"
,
get
(
is_present
))
}
pub
async
fn
run
(
alkane_config
:
AlkaneConfig
)
->
bool
{
let
server_config
=
ServerConfig
::
from_env_or
(
get_default_config
());
let
router
=
get_router
()
.
with_state
(
alkane_config
);
App
::
new
(
server_config
,
router
).
run
().
await
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 13, 00:18 (6 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4215056
Default Alt Text
kernel.rs (1 KB)
Attached To
Mode
rALK Alkane
Attached
Detach File
Event Timeline
Log In to Comment