Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	public/config.json
#	src/App.vue
  • Loading branch information
Miuss authored and Miuss committed Dec 30, 2024
2 parents 0224a4d + 5e8c478 commit 411829d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"socket": "wss://api.cpu.icu/ws",
"apiURL": "https://api.cpu.icu"
"socket": "ws://192.168.31.64:3000/ws",
"apiURL": "http://192.168.31.64:3000"
}
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ provide('handleChangeType', handleChangeType)
<a-button type="primary" :long="true" @click="handleEditHost">{{$t('edit-host-btn')}}</a-button>
</div>
</a-modal>
<div class="footer" style="margin-top: 30px">{{$t('open-source')}} <a href="https://github.com/akile-network/akile_monitor">GitHub v0.0.1</a></div>
<div class="footer" style="margin-top: 30px">{{$t('open-source')}} <a href="https://github.com/akile-network/akile_monitor">GitHub v0.0.2</a></div>
<div class="footer" style="margin-bottom: 30px">Copyright © 2023-{{new Date().getFullYear()}} Akile LTD.</div>
</div>
</template>
Expand Down
27 changes: 27 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
import { fileURLToPath, URL } from 'node:url'
import { writeFileSync } from 'node:fs'
import path from 'path';

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

const generateConfig = () => ({
socket: process.env.SOCKETURL || "ws://192.168.31.64:3000/ws",
apiURL: process.env.APIURL || "http://192.168.31.64:3000",
});

// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
{
name: 'dynamic-config-json',
configureServer (server) {
// dynamic `config.json` for dev
server.middlewares.use((req, res, next) => {
if (req.url === '/config.json') {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(generateConfig()));
} else {
next();
}
});
},
closeBundle () {
// static `config.json` for prod
const configPath = path.resolve(__dirname, 'dist/config.json');
writeFileSync(configPath, JSON.stringify(generateConfig(), null, 2));
console.log('Generated config.json:', generateConfig());
},
},
],
resolve: {
alias: {
Expand Down

0 comments on commit 411829d

Please sign in to comment.