使用我自己的型号forge autodesk显示自己的CSV数据

发布于 2025-02-13 07:25:52 字数 1243 浏览 0 评论 0原文

希望大家一切都好。我在在Autodesk Forge参考应用程序中显示自己的FORGE数据遇到困难。我当前的.env文件如下。但是,每当我在http:// localhost中启动它时:9000/上传我所获得的一切都是空白的空屏幕。

FORGE_CLIENT_ID=STEHw2Qx... marked ...xrIJUeKRj6 #changed for post
FORGE_CLIENT_SECRET=A54... marked ...c348a #changed for post
FORGE_ENV=AutodeskProduction
FORGE_API_URL=https://developer.api.autodesk.com
FORGE_CALLBACK_URL=http://localhost:9000/oauth/callback

FORGE_BUCKET=cosmostool1.cosmosengineering.es #changed for post
ENV=local

#ADAPTER_TYPE=local
## Connect to Azure IoTHub and Time Series Insights
# ADAPTER_TYPE=azure
# AZURE_IOT_HUB_CONNECTION_STRING=
# AZURE_TSI_ENV=
#
## Azure Service Principle
# AZURE_CLIENT_ID=
# AZURE_APPLICATION_SECRET=
#
## Path to Device Model configuration File
# DEVICE_MODEL_JSON=
## End - Connect to Azure IoTHub and Time Series Insights

ADAPTER_TYPE=csv
CSV_MODEL_JSON=server/gateways/synthetic-data/device-models.json
CSV_DEVICE_JSON=server/gateways/synthetic-data/devices.json
CSV_DATA_END=2011-02-20T13:51:10.511Z  #Format: YYYY-MM-DDTHH:MM:SS.000Z
CSV_DELIMITER="\t"
CSV_LINE_BREAK="\n"
CSV_TIMESTAMP_COLUMN="time"

if (process.env.ENV == "local") {
    require("dotenv").config({
        path: __dirname + "/../.env",
    });
}

I hope you all are well. I am having trouble with displaying my own forge data in the AutoDesk Forge reference application. My current .env file is as follows. However, whenever I launch it in http://localhost:9000/upload all I get in return is a blank empty screen.

FORGE_CLIENT_ID=STEHw2Qx... marked ...xrIJUeKRj6 #changed for post
FORGE_CLIENT_SECRET=A54... marked ...c348a #changed for post
FORGE_ENV=AutodeskProduction
FORGE_API_URL=https://developer.api.autodesk.com
FORGE_CALLBACK_URL=http://localhost:9000/oauth/callback

FORGE_BUCKET=cosmostool1.cosmosengineering.es #changed for post
ENV=local

#ADAPTER_TYPE=local
## Connect to Azure IoTHub and Time Series Insights
# ADAPTER_TYPE=azure
# AZURE_IOT_HUB_CONNECTION_STRING=
# AZURE_TSI_ENV=
#
## Azure Service Principle
# AZURE_CLIENT_ID=
# AZURE_APPLICATION_SECRET=
#
## Path to Device Model configuration File
# DEVICE_MODEL_JSON=
## End - Connect to Azure IoTHub and Time Series Insights

ADAPTER_TYPE=csv
CSV_MODEL_JSON=server/gateways/synthetic-data/device-models.json
CSV_DEVICE_JSON=server/gateways/synthetic-data/devices.json
CSV_DATA_END=2011-02-20T13:51:10.511Z  #Format: YYYY-MM-DDTHH:MM:SS.000Z
CSV_DELIMITER="\t"
CSV_LINE_BREAK="\n"
CSV_TIMESTAMP_COLUMN="time"

if (process.env.ENV == "local") {
    require("dotenv").config({
        path: __dirname + "/../.env",
    });
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过去的过去 2025-02-20 07:25:52

因为有这条线 forge-dataviz-iot-iot-reference-app/server/router/index.js#l25 ,您必须指定env = local在执行NPM运行dev之前。否则,它不会读取.env的内容。

if (process.env.ENV == "local") {
    require("dotenv").config({
        path: __dirname + "/../.env",
    });
}

或者,您可以将其更改为以下

require("dotenv").config({
        path: __dirname + "/../.env",
});

”在此处输入图像描述”

Because of this line at forge-dataviz-iot-reference-app/server/router/Index.js#L25, you must specify ENV=local before executing npm run dev. Otherwise, it won't read the content of .env.

if (process.env.ENV == "local") {
    require("dotenv").config({
        path: __dirname + "/../.env",
    });
}

Or you can just change it to the below

require("dotenv").config({
        path: __dirname + "/../.env",
});

enter image description here

弱骨蛰伏 2025-02-20 07:25:52

在您的目录中安装dotenv

npm install dotenv

创建config.js文件,然后添加以下代码;

const dotenv = require('dotenv');
dotenv.config();
module.exports = {
    // Set environment variables or hard-code here
    azure: {
        azure_conn_string: process.env.AZURE_IOT_HUB_EVENT_HUB_CONNECTION_STRING
    }
};

更新您的localser.js文件

const { app, router } = require("./app.js");
const config = require('./config');
app.use(router);
const server = require("http").createServer(app);

if (config.azure.azure_conn_string) {
    require("./RealTimeApi.js").createSocketIOServer(server);
}

const PORT = process.env.PORT || 9000;

async function start() {
    try { server.listen(PORT, () => { console.log(`localhost: ${PORT}`); }); } catch (error) { console.log(error); }
} start();

Install dotenv

npm install dotenv

Create a config.js file in your directory and add the following code;

const dotenv = require('dotenv');
dotenv.config();
module.exports = {
    // Set environment variables or hard-code here
    azure: {
        azure_conn_string: process.env.AZURE_IOT_HUB_EVENT_HUB_CONNECTION_STRING
    }
};

Update your localserver.js file

const { app, router } = require("./app.js");
const config = require('./config');
app.use(router);
const server = require("http").createServer(app);

if (config.azure.azure_conn_string) {
    require("./RealTimeApi.js").createSocketIOServer(server);
}

const PORT = process.env.PORT || 9000;

async function start() {
    try { server.listen(PORT, () => { console.log(`localhost: ${PORT}`); }); } catch (error) { console.log(error); }
} start();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文