Skip to content

Commit

Permalink
Merge pull request #1 from tl-open-source/feat-init-project
Browse files Browse the repository at this point in the history
feat: first init project
  • Loading branch information
iamtsm authored Feb 7, 2025
2 parents 6ae4eb7 + 87937eb commit 30ed2d5
Show file tree
Hide file tree
Showing 240 changed files with 72,762 additions and 104 deletions.
113 changes: 11 additions & 102 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,39 @@
# ---> Node
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/
# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

# FuseBox cache
.fusebox/
.DS_Store

# DynamoDB Local files
.dynamodb/
dist/

# TernJS port file
.tern-port
tmp/

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.VSCodeCounter/

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
electron-dist/
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# tl-rtc-app
tl rtc apps
![TL-RTC-APP Logo](web-v2-res/image/tlrtcapp-logo.svg)

### 安装步骤

1. 克隆仓库:
```bash
git clone https://github.com/tl-open-source/tl-rtc-app.git
```
2. 进入项目目录:
```bash
cd tl-rtc-app
```
3. 安装依赖:
```bash
npm install
```

### 使用说明
1. 启动应用:
```bash
npm start
```
2. 打开浏览器并访问 `http://localhost:9096`


### 许可证
该项目根据 MIT 许可证授权。有关详细信息,请参阅 [LICENSE](LICENSE) 文件。
66 changes: 66 additions & 0 deletions conf/env_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const path = require("path");
const dotEnv = require("dotenv");

/**
* 从.env文件中加载环境变量
* docker环境下,使用docker-compose.yml中指定的env逻辑,不使用主动加载的.env文件中的环境变量
* docker环境下,使用docker run 中指定的 -e 逻辑,不使用主动加载的.env文件中的环境变量
* 非docker环境下,使用.env文件中的环境变量
*/
const load_env_config = function(){
if(process.env.tl_rtc_app_node_load_env === 'false'){
return
}
const pathsEnv = path.resolve(__dirname, "../")
dotEnv.config({ path: `${pathsEnv}/tlrtcapp.env` })
console.log(`load env config from .env file ${pathsEnv}/tlrtcapp.env`)
}

/**
* 从环境变量中注入配置
* 1. 适配容器环境
* 2. 数据格式转换
* 3. 统一管理
*/
const get_env_config = function () {
let defaultConfJson = {}

Object.keys(process.env).filter( key => key.startsWith("tl_rtc_app_") ).map(key => {
let value = process.env[key]
key = key.replace("tl_rtc_app_","")

//端口相关的配置转换为数字
if (key.endsWith('_port')) {
value = parseInt(value)
}

//过期时间相关的配置转换为数字
if(key.endsWith("_expire")){
value = parseInt(value)
}

//开关相关的配置转换为boolean
if (key.endsWith('_open')) {
value = value === 'true'
}

//openai keys转换为数组
if(key === 'openai_keys'){
value = value.split(',')
}

//企业微信通知 keys转换为数组
if(key === 'notify_qiwei_normal' || key === 'notify_qiwei_error'){
value = value.split(',')
}

defaultConfJson[key] = value
})

return defaultConfJson
}

module.exports = {
get_env_config,
load_env_config
}
15 changes: 15 additions & 0 deletions conf/keys/server.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-----BEGIN CERTIFICATE-----
MIICVTCCAb4CCQCCDZ6FebPIqjANBgkqhkiG9w0BAQsFADBvMQswCQYDVQQGEwJV
UzENMAsGA1UECAwETWFyczETMBEGA1UEBwwKaVRyYW5zd2FycDETMBEGA1UECgwK
aVRyYW5zd2FycDETMBEGA1UECwwKaVRyYW5zd2FycDESMBAGA1UEAwwJMTI3LjAu
MC4xMB4XDTE4MDcxMDAzMTYzN1oXDTI4MDcwNzAzMTYzN1owbzELMAkGA1UEBhMC
VVMxDTALBgNVBAgMBE1hcnMxEzARBgNVBAcMCmlUcmFuc3dhcnAxEzARBgNVBAoM
CmlUcmFuc3dhcnAxEzARBgNVBAsMCmlUcmFuc3dhcnAxEjAQBgNVBAMMCTEyNy4w
LjAuMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1I6AQ6eNez85kcKjwy3g
/vcnXtw+EbP4Ab37fLhIIWG+XzmEBAqnCYjM3nmlDIGEfNylGReo9mD2OHg46a1D
wjd3pxTMit41pCTCiu8S9A2UJfbhSzQrfs+IZcNye4KR9/FzNEW6KoKQ0uc6X33E
0xe41hbRMQoKB3WmxvyN8PcCAwEAATANBgkqhkiG9w0BAQsFAAOBgQAd7GNDtKWA
0OpSCzMu0pbmss9Erh4/RC8D+wK4+TXgPDKyZ6hX4FYPvk+ryMvwxJf0o4jjx5cx
Yew7UjaKHlGXq+CNVRFYlltsbvO3oQTNkajuyYGWzMSuNxNsT3apOxH7SIu3qao8
COSwj5FxZ2JU7O+SBVFZoJrFXEa+KJMQzQ==
-----END CERTIFICATE-----
15 changes: 15 additions & 0 deletions conf/keys/server.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQDUjoBDp417PzmRwqPDLeD+9yde3D4Rs/gBvft8uEghYb5fOYQE
CqcJiMzeeaUMgYR83KUZF6j2YPY4eDjprUPCN3enFMyK3jWkJMKK7xL0DZQl9uFL
NCt+z4hlw3J7gpH38XM0RboqgpDS5zpffcTTF7jWFtExCgoHdabG/I3w9wIDAQAB
AoGAWsy1BjGhQrDzisy24D3NC53Q97jl2vIiU7wwnkqqpXf3tv3+4ysZx/zkZ3VX
iEwbqKso69srlnQ9OkpBJbGaa6lZe+z7BGzv2eJr+hKjjVjR122eDjAtXw+Tmt6c
iBUG9+ITC1GdhXLEgTXtYuPq8hbDhoAVI007E+5JuQoO8kECQQD3aR6zGfR7EOmn
byGkNMMPY/FoH894BpB4l7gIlNXH3pxBqukrEwnmVXSfak2PAkeLFO+bgCc6baIZ
+R4iOLn/AkEA2++dIndbY7nmGs7Q//sM7MkFMiFQ4h1nN38V9AEHaUonxlwo+Nks
PTAaVd78YIh6yBlfexm0Fxi1mEVQApqZCQJAFUPqyJglhGJqwuJxcMy8K1l6yWla
isV9q2/W+J3aViiTI63OBs7HHg4gTQd1DSK0BYdSJPp55LLBqRvZdDWN/wJBAMQa
M46exAL4p55xl9MWwyCB4LshD6B9vSGzlBx7qmMMNsjcNcAkzBhGwsScTYW5S1kN
nqABfB037/s0mjGoLRkCQF18j4MovyFaj8VAqY8YUmf86Ez9JmL9kHNA8yEoSjuI
xsRa6y5Nza5y83Mojt4W+PfS386riJ7txqrPdezyag4=
-----END RSA PRIVATE KEY-----
Loading

0 comments on commit 30ed2d5

Please sign in to comment.