~starkingdoms/starkingdoms

5ba3d172a4345f4dd187ecdbefcf6e26fefc0a39 — core 1 year, 11 months ago e046987
load keys from json instead of from bytes
1 files changed, 11 insertions(+), 5 deletions(-)

M server/src/main.rs
M server/src/main.rs => server/src/main.rs +11 -5
@@ 50,7 50,7 @@ pub mod macros;
pub mod mathutil;
pub mod packet;

const CLIENT_SCALE: f32 = 50.;
const CLIENT_SCALE: f32 = 50.0;

const EARTH_SIZE: f32 = 20.0;
const MOON_SIZE: f32 = EARTH_SIZE / 4.;


@@ 66,9 66,9 @@ const PART_HALF_SIZE: f32 = 25.0;
const HEARTY_THRUSTER_FORCE: f32 = 0.3;
const LANDING_THRUSTER_FORCE: f32 = 5.;

const HEARTY_MASS: f32 = 1.;
const HEARTY_MASS: f32 = 1.0;
const CARGO_MASS: f32 = 0.5;
const HUB_MASS: f32 = 1.;
const HUB_MASS: f32 = 1.0;
const LANDING_THRUSTER_MASS: f32 = 0.9;

// maybe make this only cargo modules later


@@ 114,13 114,19 @@ pub struct UserToken {

pub const REQUIRED_PERM_LEVEL: i32 = 10;

#[derive(Deserialize)]
struct KeyJson {
    app_key: String,
}

fn main() {
    // read the key in
    let key = std::fs::read_to_string("/etc/starkingdoms/app_key").unwrap();
    let key = std::fs::read_to_string("/etc/starkingdoms/keys.json").unwrap();
    let keyjson: KeyJson = serde_json::from_str(&key).unwrap();

    App::new()
        .insert_resource(AppKeys {
            app_key: key.into_bytes(),
            app_key: keyjson.app_key.as_bytes(),
        })
        .insert_resource(StkTungsteniteServerConfig {
            addr: IpAddr::from_str("0.0.0.0").unwrap(),