Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

Defaults ZIPKIN_BASE_URL to same origin in production config #38

Merged
merged 1 commit into from
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion config/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
var webpack = require('webpack');
var webpackMerge = require('webpack-merge');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');

const ZIPKIN_BASE_URL = process.env.ZIPKIN_BASE_URL || 'http://localhost:9411';

module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-eval-source-map',

Expand All @@ -14,7 +17,12 @@ module.exports = webpackMerge(commonConfig, {
},

plugins: [
new ExtractTextPlugin('[name].css')
new ExtractTextPlugin('[name].css'),
new webpack.DefinePlugin({
'process.env': {
'ZIPKIN_BASE_URL': JSON.stringify(ZIPKIN_BASE_URL)
}
}),
],

devServer: {
Expand Down
2 changes: 0 additions & 2 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ var commonConfig = require('./webpack.common.js');
var helpers = require('./helpers');

const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const ZIPKIN_BASE_URL = process.env.ZIPKIN_BASE_URL;

module.exports = webpackMerge(commonConfig, {
devtool: 'source-map',
Expand All @@ -24,7 +23,6 @@ module.exports = webpackMerge(commonConfig, {
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV),
'ZIPKIN_BASE_URL': JSON.stringify(ZIPKIN_BASE_URL)
}
}),
new webpack.LoaderOptionsPlugin({
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ $ wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a
$ java -jar zipkin.jar
```

If you want to test against a different zipkin server, export the `ZIPKIN_BASE_URL` appropriately.

```bash
$ ZIPKIN_BASE_URL=http://192.168.99.100:9411 npm start
```

## Production Build
The production build is made for same origin deployment. Take a look at our [nginx configuration](https://github.com/openzipkin/docker-zipkin/blob/master/zipkin-ui/nginx.conf) for an example. This is used in the "openzipkin/zipkin-ui" docker image.

```bash
$ npm run build
```
Expand Down
2 changes: 1 addition & 1 deletion src/app/tracegraph/tracegraph.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class TraceGraphComponent implements OnInit {
baseUrl: string;

constructor( @Inject(ElementRef) private element: ElementRef, @Inject(Http) private http: Http) {
this.baseUrl = process.env.ZIPKIN_BASE_URL || 'http://localhost:9411';
this.baseUrl = process.env.ZIPKIN_BASE_URL || ''; // default to same origin
}

ngOnInit() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/zipkin/zipkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class ZipkinService {
services: string[];

constructor( @Inject(Http) private http: Http) {
this.baseUrl = process.env.ZIPKIN_BASE_URL || 'http://localhost:9411';
this.baseUrl = process.env.ZIPKIN_BASE_URL || ''; // default to same origin
this.traces = null;
}

Expand Down