Code Monkey home page Code Monkey logo

Comments (3)

VibhavSurve09 avatar VibhavSurve09 commented on June 20, 2024 1

Associated functions you are trying to access are deprecated since 0.12, maybe try using something like below code

use config::Config;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct ServerConfig {
    pub host: String,
    pub port: u16,
}

impl ServerConfig {
    pub fn from_env() -> Self {
        let _config = Config::builder()
            .add_source(::config::Environment::default())
            .build()
            .unwrap();
        let config: ServerConfig = _config.try_deserialize().unwrap();
        config
    }
}
[dependencies]
actix-web = "4"
config = "0.13.1"

Reference :
Config Doc https://docs.rs/config/0.13.1/config/index.html,
Official example from actix web https://github.com/actix/examples/blob/master/databases/postgres/src/main.rs

from actix-todo.

igotfr avatar igotfr commented on June 20, 2024

@VibhavSurve09 I'm referring the files in this repo:
https://github.com/nemesiscodex/actix-todo/blob/master/src/config.rs
https://github.com/nemesiscodex/actix-todo/blob/master/Cargo.toml

from actix-todo.

igotfr avatar igotfr commented on June 20, 2024

actix/examples#537

from actix-todo.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.